Skip to content

Commit 5c5d322

Browse files
authored
Set up automagic deploy (#65)
1 parent c6612e4 commit 5c5d322

File tree

2 files changed

+105
-10
lines changed

2 files changed

+105
-10
lines changed

.circleci/config.yml

+100-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,32 @@
11
version: 2.1
2+
3+
workflows:
4+
version: 2
5+
default:
6+
jobs:
7+
- reflection:
8+
filters:
9+
tags:
10+
only: /.*/
11+
12+
- openjdk-8:
13+
filters:
14+
tags:
15+
only: /.*/
16+
17+
- openjdk-11:
18+
filters:
19+
tags:
20+
only: /.*/
21+
22+
- deploy:
23+
requires: [openjdk-8, openjdk-11, reflection]
24+
filters:
25+
tags:
26+
only: /Release-.*/
27+
context:
28+
- CLOJARS_DEPLOY
29+
230
commands:
331
setup-project:
432
description: "Setup project"
@@ -79,10 +107,75 @@ jobs:
79107
- setup-project
80108
- run-tests
81109

82-
workflows:
83-
version: 2
84-
default:
85-
jobs:
86-
- reflection
87-
- openjdk-8
88-
- openjdk-11
110+
deploy:
111+
docker:
112+
# specify the version you desire here
113+
- image: circleci/clojure:openjdk-8-lein-2.9.1
114+
# Specify service dependencies here if necessary
115+
# CircleCI maintains a library of pre-built images
116+
# documented at https://circleci.com/docs/2.0/circleci-images/
117+
# - image: circleci/postgres:9.4
118+
119+
working_directory: ~/repo
120+
121+
environment:
122+
LEIN_ROOT: "true"
123+
# Customize the JVM maximum heap limit
124+
JVM_OPTS: -Xmx3200m
125+
126+
steps:
127+
- checkout
128+
129+
# Download and cache dependencies
130+
- restore_cache:
131+
keys:
132+
- v1-dependencies-{{ checksum "project.clj" }}
133+
# fallback to using the latest cache if no exact match is found
134+
- v1-dependencies-
135+
136+
# Download and cache dependencies
137+
- restore_cache:
138+
keys:
139+
- v1-dependencies-{{ checksum "project.clj" }}
140+
# fallback to using the latest cache if no exact match is found
141+
- v1-dependencies-
142+
143+
- run:
144+
name: Install babashka
145+
command: |
146+
curl -s https://raw.githubusercontent.com/borkdude/babashka/master/install -o install.sh
147+
sudo bash install.sh
148+
rm install.sh
149+
- run:
150+
name: Install deployment-script
151+
command: |
152+
curl -s https://raw.githubusercontent.com/clj-commons/infra/main/deployment/circle-maybe-deploy.bb -o circle-maybe-deploy.bb
153+
chmod a+x circle-maybe-deploy.bb
154+
155+
- run: lein deps
156+
157+
- run:
158+
name: Setup GPG signing key
159+
command: |
160+
GNUPGHOME="$HOME/.gnupg"
161+
export GNUPGHOME
162+
mkdir -p "$GNUPGHOME"
163+
chmod 0700 "$GNUPGHOME"
164+
165+
echo "$GPG_KEY" \
166+
| base64 --decode --ignore-garbage \
167+
| gpg --batch --allow-secret-key-import --import
168+
169+
gpg --keyid-format LONG --list-secret-keys
170+
171+
- save_cache:
172+
paths:
173+
- ~/.m2
174+
key: v1-dependencies-{{ checksum "project.clj" }}
175+
- run:
176+
name: Deploy
177+
command: |
178+
GPG_TTY=$(tty)
179+
export GPG_TTY
180+
echo $GPG_TTY
181+
./circle-maybe-deploy.bb lein deploy clojars

project.clj

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1-
(defproject org.flatland/ordered "1.5.10-SNAPSHOT"
1+
(defproject org.flatland/ordered (or (System/getenv "PROJECT_VERSION") "1.5.10")
22
:url "https://github.com/clj-commons/ordered"
33
:license {:name "Eclipse Public License - v 1.0"
44
:url "http://www.eclipse.org/legal/epl-v10.html"}
55
:description "Pure-clojure implementation of ruby's ordered hash and set types - instead of sorting by key, these collections retain insertion order."
66
:dependencies [[org.clojure/clojure "1.10.1"]]
77
:aliases {"testall" ["with-profile" "+1.8:+1.9:+1.10.0:+1.10.1" "test"]
88
"depsall" ["with-profile" "+1.8:+1.9:+1.10.0:+1.10.1" "deps"]}
9-
:deploy-repositories [["releases" :clojars]
10-
["snapshots" :clojars]]
9+
:deploy-repositories [["clojars" {:url "https://repo.clojars.org"
10+
:username :env/clojars_username
11+
:password :env/clojars_ordered_password
12+
:sign-releases true}]]
1113
:profiles {:1.10.1 {:dependencies [[org.clojure/clojure "1.10.1"]]}
1214
:1.10.0 {:dependencies [[org.clojure/clojure "1.10.0"]]}
1315
:1.9 {:dependencies [[org.clojure/clojure "1.9.0"]]}

0 commit comments

Comments
 (0)