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