|
| 1 | +version: 2.1 |
| 2 | + |
| 3 | +workflows: |
| 4 | + build-deploy: |
| 5 | + jobs: |
| 6 | + - build: |
| 7 | + filters: |
| 8 | + tags: |
| 9 | + only: /.*/ |
| 10 | + |
| 11 | + - deploy: |
| 12 | + requires: |
| 13 | + - build |
| 14 | + filters: |
| 15 | + tags: |
| 16 | + only: /Release-.*/ |
| 17 | + context: |
| 18 | + - CLOJARS_DEPLOY |
| 19 | + |
| 20 | +jobs: |
| 21 | + build: |
| 22 | + docker: |
| 23 | + # specify the version you desire here |
| 24 | + - image: clojure:openjdk-8-lein-2.9.8-bullseye |
| 25 | + |
| 26 | + # Specify service dependencies here if necessary |
| 27 | + # CircleCI maintains a library of pre-built images |
| 28 | + # documented at https://circleci.com/docs/2.0/circleci-images/ |
| 29 | + # - image: circleci/postgres:9.4 |
| 30 | + |
| 31 | + working_directory: ~/repo |
| 32 | + |
| 33 | + environment: |
| 34 | + LEIN_ROOT: "true" |
| 35 | + # Customize the JVM maximum heap limit |
| 36 | + JVM_OPTS: -Xmx3200m |
| 37 | + |
| 38 | + steps: |
| 39 | + - checkout |
| 40 | + |
| 41 | + # Download and cache dependencies |
| 42 | + - restore_cache: |
| 43 | + keys: |
| 44 | + - v1-dependencies-{{ checksum "project.clj" }} |
| 45 | + # fallback to using the latest cache if no exact match is found |
| 46 | + - v1-dependencies- |
| 47 | + |
| 48 | + - run: lein deps |
| 49 | + |
| 50 | + - save_cache: |
| 51 | + paths: |
| 52 | + - ~/.m2 |
| 53 | + key: v1-dependencies-{{ checksum "project.clj" }} |
| 54 | + |
| 55 | + - run: |
| 56 | + name: Ensure No Reflection Warnings |
| 57 | + command: "! lein check 2>&1 | grep 'Reflection warning'" |
| 58 | + |
| 59 | + # run tests! |
| 60 | + - run: lein do clean, test |
| 61 | + |
| 62 | + deploy: |
| 63 | + docker: |
| 64 | + # specify the version you desire here |
| 65 | + - image: clojure:openjdk-8-lein-2.9.8-bullseye |
| 66 | + # Specify service dependencies here if necessary |
| 67 | + # CircleCI maintains a library of pre-built images |
| 68 | + # documented at https://circleci.com/docs/2.0/circleci-images/ |
| 69 | + # - image: circleci/postgres:9.4 |
| 70 | + |
| 71 | + working_directory: ~/repo |
| 72 | + |
| 73 | + environment: |
| 74 | + LEIN_ROOT: "true" |
| 75 | + # Customize the JVM maximum heap limit |
| 76 | + JVM_OPTS: -Xmx3200m |
| 77 | + |
| 78 | + steps: |
| 79 | + - checkout |
| 80 | + |
| 81 | + # Download and cache dependencies |
| 82 | + - restore_cache: |
| 83 | + keys: |
| 84 | + - v1-dependencies-{{ checksum "project.clj" }} |
| 85 | + # fallback to using the latest cache if no exact match is found |
| 86 | + - v1-dependencies- |
| 87 | + |
| 88 | + # Download and cache dependencies |
| 89 | + - restore_cache: |
| 90 | + keys: |
| 91 | + - v1-dependencies-{{ checksum "project.clj" }} |
| 92 | + # fallback to using the latest cache if no exact match is found |
| 93 | + - v1-dependencies- |
| 94 | + |
| 95 | + - run: |
| 96 | + name: Install babashka |
| 97 | + command: | |
| 98 | + curl -s https://raw.githubusercontent.com/borkdude/babashka/master/install -o install.sh |
| 99 | + bash install.sh |
| 100 | + rm install.sh |
| 101 | + - run: |
| 102 | + name: Install deployment-script |
| 103 | + command: | |
| 104 | + curl -s https://raw.githubusercontent.com/clj-commons/infra/main/deployment/circle-maybe-deploy.bb -o circle-maybe-deploy.bb |
| 105 | + chmod a+x circle-maybe-deploy.bb |
| 106 | +
|
| 107 | + - run: lein deps |
| 108 | + |
| 109 | + - run: |
| 110 | + name: Setup GPG signing key |
| 111 | + command: | |
| 112 | + apt-get update |
| 113 | + apt-get install -y make gnupg |
| 114 | + GNUPGHOME="$HOME/.gnupg" |
| 115 | + export GNUPGHOME |
| 116 | + mkdir -p "$GNUPGHOME" |
| 117 | + chmod 0700 "$GNUPGHOME" |
| 118 | +
|
| 119 | + echo "$GPG_KEY" \ |
| 120 | + | base64 --decode --ignore-garbage \ |
| 121 | + | gpg --batch --allow-secret-key-import --import |
| 122 | +
|
| 123 | + gpg --keyid-format LONG --list-secret-keys |
| 124 | +
|
| 125 | + - save_cache: |
| 126 | + paths: |
| 127 | + - ~/.m2 |
| 128 | + key: v1-dependencies-{{ checksum "project.clj" }} |
| 129 | + - run: |
| 130 | + name: Deploy |
| 131 | + command: | |
| 132 | + GPG_TTY=$(tty) |
| 133 | + export GPG_TTY |
| 134 | + echo $GPG_TTY |
| 135 | + ./circle-maybe-deploy.bb lein deploy clojars |
0 commit comments