Skip to content

Commit 9a920ad

Browse files
authored
Setup deploy (#64)
1 parent a4bd33f commit 9a920ad

File tree

2 files changed

+100
-19
lines changed

2 files changed

+100
-19
lines changed

.circleci/config.yml

+94-18
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,24 @@
1-
# Use the latest 2.1 version of CircleCI pipeline process engine.
2-
# See: https://circleci.com/docs/2.0/configuration-reference
3-
# For a detailed guide to building and testing with clojure, read the docs:
4-
# https://circleci.com/docs/2.0/language-clojure/ for more details
51
version: 2.1
62

7-
# Define a job to be invoked later in a workflow.
8-
# See: https://circleci.com/docs/2.0/configuration-reference/#jobs
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+
920
jobs:
1021
build:
11-
# Specify the execution environment. You can specify an image from Dockerhub or use one of our Convenience Images from CircleCI's Developer Hub.
12-
# See: https://circleci.com/docs/2.0/configuration-reference/#docker-machine-macos-windows-executor
1322
docker:
1423
# specify the version you desire here
1524
- image: clojure:openjdk-8-lein-2.9.8-bullseye
@@ -26,8 +35,6 @@ jobs:
2635
# Customize the JVM maximum heap limit
2736
JVM_OPTS: -Xmx3200m
2837

29-
# Add steps to the job
30-
# See: https://circleci.com/docs/2.0/configuration-reference/#steps
3138
steps:
3239
- checkout
3340

@@ -45,13 +52,82 @@ jobs:
4552
- ~/.m2
4653
key: v1-dependencies-{{ checksum "project.clj" }}
4754

55+
- run:
56+
name: Ensure No Reflection Warnings
57+
command: "! lein check 2>&1 | grep 'Reflection warning'"
58+
4859
# run tests!
49-
- run: lein test
60+
- run: lein do clean, test
5061

51-
# Invoke jobs via workflows
52-
# See: https://circleci.com/docs/2.0/configuration-reference/#workflows
53-
workflows:
54-
sample: # This is the name of the workflow, feel free to change it to better match your workflow.
55-
# Inside the workflow, you define the jobs you want to run.
56-
jobs:
57-
- build
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+
sudo 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+
GNUPGHOME="$HOME/.gnupg"
113+
export GNUPGHOME
114+
mkdir -p "$GNUPGHOME"
115+
chmod 0700 "$GNUPGHOME"
116+
117+
echo "$GPG_KEY" \
118+
| base64 --decode --ignore-garbage \
119+
| gpg --batch --allow-secret-key-import --import
120+
121+
gpg --keyid-format LONG --list-secret-keys
122+
123+
- save_cache:
124+
paths:
125+
- ~/.m2
126+
key: v1-dependencies-{{ checksum "project.clj" }}
127+
- run:
128+
name: Deploy
129+
command: |
130+
GPG_TTY=$(tty)
131+
export GPG_TTY
132+
echo $GPG_TTY
133+
./circle-maybe-deploy.bb lein deploy clojars

project.clj

+6-1
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,17 @@
1212
;; and limitations under the License.
1313

1414
(defproject org.clj-commons/claypoole
15-
"1.2.0-SNAPSHOT"
15+
(or (System/getenv "PROJECT_VERSION") "1.2.0")
1616
:description "Claypoole: Threadpool tools for Clojure."
1717
:url "https://github.com/clj-commons/claypoole"
1818
:license {:name "Apache License Version 2.0"
1919
:url "http://www.apache.org/licenses/LICENSE-2.0"
2020
:distribution :repo}
21+
:deploy-repositories [["clojars" {:url "https://repo.clojars.org"
22+
:username :env/clojars_username
23+
:password :env/clojars_password
24+
:sign-releases true}]]
25+
2126
:min-lein-version "2.0.0"
2227
:source-paths ["src/clj"]
2328
:java-source-paths ["src/java"]

0 commit comments

Comments
 (0)