From 9fea63e9593b1142a87a038cdd9f203f8fad77ff Mon Sep 17 00:00:00 2001 From: Rick Moynihan Date: Tue, 4 Jan 2022 14:30:29 +0000 Subject: [PATCH] Deploy on tag --- .circleci/config.yml | 10 +++++++--- build.clj | 14 +++++--------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 8afd9b6..5ca2d5b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -37,13 +37,17 @@ jobs: workflows: build-workflow: jobs: - - test + - test: + filters: # required since `deploy` has tag filters AND requires `test` + tags: + only: /.*/ - deploy: context: - clojars-publisher filters: + tags: + only: /^v.*/ branches: - only: - - master + ignore: /.*/ requires: - test diff --git a/build.clj b/build.clj index 88c9a4b..c1b727b 100644 --- a/build.clj +++ b/build.clj @@ -4,7 +4,8 @@ (:refer-clojure :exclude [test])) (def lib 'grafter/matcha.alpha) -(def version (format "0.2.%s" (b/git-count-revs nil))) +(def version (System/getenv "CIRCLE_TAG")) + (def jar-file (format "target/%s-%s.jar" (name lib) version)) (defn test @@ -29,16 +30,11 @@ (assoc :lib lib :version version) (bb/install))) -(defn tag [{:keys [version] :as opts}] - (let [vtag (str "v" version)] - (b/git-process {:git-args ["tag" vtag]}) - (b/git-process {:git-args ["push" "origin" vtag]})) - opts) - (defn deploy - "Deploy the JAR to Clojars." + "Deploy the JAR to Clojars. + + NOTE: this expects a tag to be set; typically done via the github release UI." [opts] (-> opts (assoc :lib lib :version version) - (tag) (bb/deploy)))