From 8ba499b1ff3000be8822664dd7883a1510156d55 Mon Sep 17 00:00:00 2001 From: Erik Assum Date: Fri, 24 Sep 2021 08:14:43 +0200 Subject: [PATCH 1/4] Update CI/CD to not need local maybe-deploy --- .circleci/config.yml | 47 +++++++++++++++++++++++++++++++++++++++----- 1 file changed, 42 insertions(+), 5 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 9ada69b..e3c5262 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -7,13 +7,20 @@ version: 2.1 workflows: build-deploy: jobs: - - build + - build: + filters: + tags: + only: /.*/ - deploy: requires: - build + filters: + tags: + only: /Release-.*/ context: - CLOJARS_DEPLOY + jobs: build: docker: @@ -54,7 +61,7 @@ jobs: - run: lein eastwood - deploy: +deploy: docker: # specify the version you desire here - image: circleci/clojure:openjdk-8-lein-2.9.1 @@ -73,6 +80,13 @@ jobs: steps: - checkout + # Download and cache dependencies + - restore_cache: + keys: + - v1-dependencies-{{ checksum "project.clj" }} + # fallback to using the latest cache if no exact match is found + - v1-dependencies- + # Download and cache dependencies - restore_cache: keys: @@ -82,13 +96,36 @@ jobs: - run: name: Install babashka - command: bash <(curl -s https://raw.githubusercontent.com/borkdude/babashka/master/install) --dir . --download-dir . - - run: lein with-profile ci deps + command: | + curl -s https://raw.githubusercontent.com/borkdude/babashka/master/install -o install.sh + sudo bash install.sh + rm install.sh + - run: + name: Install deployment-script + command: | + curl -s https://raw.githubusercontent.com/clj-commons/infra/main/deployment/circle-maybe-deploy.bb -o circle-maybe-deploy.bb + chmod a+x circle-maybe-deploy.bb + - run: lein deps + - run: + name: Setup GPG signing key + command: | + GNUPGHOME="$HOME/.gnupg" + export GNUPGHOME + mkdir -p "$GNUPGHOME" + chmod 0700 "$GNUPGHOME" + echo "$GPG_KEY" \ + | base64 --decode --ignore-garbage \ + | gpg --batch --allow-secret-key-import --import + gpg --keyid-format LONG --list-secret-keys - save_cache: paths: - ~/.m2 key: v1-dependencies-{{ checksum "project.clj" }} - run: name: Deploy - command: .circleci/maybe-deploy.bb lein with-profile ci deploy clojars + command: | + GPG_TTY=$(tty) + export GPG_TTY + echo $GPG_TTY + ./circle-maybe-deploy.bb lein with-profile ci deploy clojars From 1b8efd2d3fae10a52be4b0965ce22f9dd1012278 Mon Sep 17 00:00:00 2001 From: Erik Assum Date: Fri, 24 Sep 2021 08:15:49 +0200 Subject: [PATCH 2/4] Yay! Whitespace --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e3c5262..68c9836 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -61,7 +61,7 @@ jobs: - run: lein eastwood -deploy: + deploy: docker: # specify the version you desire here - image: circleci/clojure:openjdk-8-lein-2.9.1 From 49d801b8b0b3f165afafab3353561e8c1e50bfde Mon Sep 17 00:00:00 2001 From: Erik Assum Date: Fri, 24 Sep 2021 08:17:01 +0200 Subject: [PATCH 3/4] hrmf --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 68c9836..4578d2e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -61,7 +61,7 @@ jobs: - run: lein eastwood - deploy: + deploy: docker: # specify the version you desire here - image: circleci/clojure:openjdk-8-lein-2.9.1 From 90ceb5f44acad376d0e9536ede40bc17ba4944e1 Mon Sep 17 00:00:00 2001 From: Erik Assum Date: Fri, 24 Sep 2021 08:18:43 +0200 Subject: [PATCH 4/4] Delete maybe-deploy.bb --- .circleci/maybe-deploy.bb | 20 -------------------- 1 file changed, 20 deletions(-) delete mode 100755 .circleci/maybe-deploy.bb diff --git a/.circleci/maybe-deploy.bb b/.circleci/maybe-deploy.bb deleted file mode 100755 index 3818cd1..0000000 --- a/.circleci/maybe-deploy.bb +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env ./bb - -(require '[clojure.java.shell :refer [sh]]) -(require '[clojure.edn :as edn]) -(require '[clojure.string :as str]) - -(defn make-version! [] - (let [v (edn/read-string (slurp "version.edn")) - commit-count (str/trim-newline (:out (sh "git" "rev-list" "--count" "--first-parent" "HEAD")))] - (str v "." commit-count))) - -(if (->> (System/getenv "CIRCLE_SHA1") - (sh "git" "show" "-s") - :out - (re-find #"\[ci deploy\]")) - (do - (println "executing " (first *command-line-args*)) - (apply sh (into (vec *command-line-args*) [:env (into {"PROJECT_VERSION" (make-version!)} - (System/getenv))]))) - (println "skipping" (first *command-line-args*)))