Skip to content

Commit 5530bdc

Browse files
authored
Set up auto-deploy (#58)
1 parent 6bc8f5f commit 5530bdc

File tree

2 files changed

+98
-3
lines changed

2 files changed

+98
-3
lines changed

.circleci/config.yml

Lines changed: 92 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,30 @@
22
#
33
# Check https://circleci.com/docs/2.0/language-clojure/ for more details
44
#
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+
624
jobs:
725
build:
826
docker:
927
# specify the version you desire here
10-
- image: circleci/clojure:lein-2.7.1
28+
- image: circleci/clojure:openjdk-8-lein-2.9.1
1129

1230
# Specify service dependencies here if necessary
1331
# CircleCI maintains a library of pre-built images
@@ -40,4 +58,76 @@ jobs:
4058

4159
# run tests!
4260
- 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
43133

project.clj

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
1-
(defproject clj-commons/iapetos "0.1.12"
1+
(defproject clj-commons/iapetos (or (System/getenv "PROJECT_VERSION") "0.1.12")
22
:description "A Clojure Prometheus Client"
33
:url "https://github.com/clj-commons/iapetos"
44
:license {:name "MIT License"
55
:url "https://opensource.org/licenses/MIT"
66
:year 2019
77
:key "mit"}
8+
:deploy-repositories [["clojars" {:url "https://repo.clojars.org"
9+
:username :env/clojars_username
10+
:password :env/clojars_password
11+
:sign-releases true}]]
12+
813
:dependencies [[org.clojure/clojure "1.10.3" :scope "provided"]
914
[io.prometheus/simpleclient "0.12.0"]
1015
[io.prometheus/simpleclient_common "0.12.0"]

0 commit comments

Comments
 (0)