Skip to content

Commit

Permalink
Refactor Deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
cartesian-theatrics committed Apr 5, 2024
1 parent 369c387 commit 2838468
Showing 1 changed file with 28 additions and 19 deletions.
47 changes: 28 additions & 19 deletions build/deploy.clj
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,41 @@
[clojure.tools.deps.alpha :as deps]
[clojure.java.io :as io]))

(defn deploy-lib []
(defn get-version-tag []
(let [version (s/trim (with-out-str
(exec/exec
"git"
{:proc-args ["describe" "--tags"]
;; The error message of the exception thrown upon error.
:error-msg "Failed to get tags"})))]
(assert (re-find #"\d+\.\d+\.\d+$" version) (format "Version ill-formated: %s" version))
version))

(defn build-jar [version ]
(let [deps-data (deps/slurp-deps (io/file "deps.edn"))
deps (merge (:deps deps-data)
(-> deps-data :aliases :clj-prod :extra-deps))
version (s/trim (with-out-str
(exec/exec "git" {:proc-args ["describe" "--tags"]
;; The error message of the exception thrown upon error.
:error-msg "Failed to get tags"})))]
(assert (re-find #"\d+\.\d+\.\d+$" version))
(-> deps-data :aliases :clj-prod :extra-deps))]
(jar/jar 'org.clojars.cartesiantheatrics/plexus {:mvn/version version}
{:out-path (format "target/plexus-%s.jar" version)
:paths ["src/main"]
:deps deps
:mvn/repos '{"clojars" {:url "https://repo.clojars.org/"}}
:exclusion-predicate jar/default-exclusion-predicate
:allow-all-dependencies? true})
(let [artifacts (-> [{:file-path (format "target/plexus-%s.jar" version)
:extension "jar"}
{:file-path "pom.xml"
:extension "pom"}]
(badigeon.sign/sign {:command "gpg"}))]
(deploy/deploy 'org.clojars.cartesiantheatrics/plexus
version
artifacts
{:url "https://repo.clojars.org/"
:id "clojars"}))))
:allow-all-dependencies? true})))

(defn deploy-lib [version]
(let [artifacts (-> [{:file-path (format "target/plexus-%s.jar" version)
:extension "jar"}
{:file-path "pom.xml"
:extension "pom"}]
(badigeon.sign/sign {:command "gpg"}))]
(deploy/deploy 'org.clojars.cartesiantheatrics/plexus
version
artifacts
{:url "https://repo.clojars.org/"
:id "clojars"})))

(defn -main [& args]
(deploy-lib) )
(let [version (get-version-tag)]
(build-jar version)
(deploy-lib version)))

0 comments on commit 2838468

Please sign in to comment.