Skip to content

Commit 7dd9be8

Browse files
committed
Setup automagic deploys
1 parent 7e3ad60 commit 7dd9be8

File tree

2 files changed

+102
-1
lines changed

2 files changed

+102
-1
lines changed

.circleci/config.yml

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,22 @@
11
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+
220
jobs:
321
build:
422
machine:
@@ -58,3 +76,80 @@ jobs:
5876
- run:
5977
name: Run tests
6078
command: lein test
79+
80+
deploy:
81+
machine:
82+
image: ubuntu-2004:2023.07.1
83+
84+
resource_class: medium
85+
86+
working_directory: ~/repo
87+
88+
environment:
89+
LEIN_ROOT: "true"
90+
# Customize the JVM maximum heap limit
91+
JVM_OPTS: -Xmx3200m
92+
93+
steps:
94+
- checkout
95+
96+
- run:
97+
name: Setup environment
98+
command: sudo apt-get update && sudo apt-get install -y openjdk-8-jdk leiningen
99+
100+
# Download and cache dependencies
101+
- restore_cache:
102+
keys:
103+
- v1-dependencies-{{ checksum "project.clj" }}
104+
# fallback to using the latest cache if no exact match is found
105+
- v1-dependencies-
106+
107+
# Download and cache dependencies
108+
- restore_cache:
109+
keys:
110+
- v1-dependencies-{{ checksum "project.clj" }}
111+
# fallback to using the latest cache if no exact match is found
112+
- v1-dependencies-
113+
114+
- run:
115+
name: Install babashka
116+
command: |
117+
curl -s https://raw.githubusercontent.com/borkdude/babashka/master/install -o install.sh
118+
bash install.sh
119+
rm install.sh
120+
- run:
121+
name: Install deployment-script
122+
command: |
123+
curl -s https://raw.githubusercontent.com/clj-commons/infra/main/deployment/circle-maybe-deploy.bb -o circle-maybe-deploy.bb
124+
chmod a+x circle-maybe-deploy.bb
125+
126+
- run: lein deps
127+
128+
- run:
129+
name: Setup GPG signing key
130+
command: |
131+
apt-get update
132+
apt-get install -y make gnupg
133+
GNUPGHOME="$HOME/.gnupg"
134+
export GNUPGHOME
135+
mkdir -p "$GNUPGHOME"
136+
chmod 0700 "$GNUPGHOME"
137+
138+
echo "$GPG_KEY" \
139+
| base64 --decode --ignore-garbage \
140+
| gpg --batch --allow-secret-key-import --import
141+
142+
gpg --keyid-format LONG --list-secret-keys
143+
144+
- save_cache:
145+
paths:
146+
- ~/.m2
147+
key: v1-dependencies-{{ checksum "project.clj" }}
148+
- run:
149+
name: Deploy
150+
command: |
151+
GPG_TTY=$(tty)
152+
export GPG_TTY
153+
echo $GPG_TTY
154+
./circle-maybe-deploy.bb lein deploy clojars
155+

project.clj

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1-
(defproject clj-commons/clj-ssh "0.6.0-SNAPSHOT"
1+
(defproject org.clj-commons/clj-ssh
2+
(or (System/getenv "PROJECT_VERSION") "0.6.0-SNAPSHOT")
23
:description "Library for using SSH from clojure."
34
:url "https://github.com/clj-commons/clj-ssh"
45
:license {:name "Eclipse Public License"
56
:url "http://www.eclipse.org/legal/epl-v10.html"}
7+
:deploy-repositories [["clojars" {:url "https://repo.clojars.org"
8+
:username :env/clojars_username
9+
:password :env/clojars_org_clj_commons_password
10+
:sign-releases true}]]
11+
612
:dependencies [[org.clojure/tools.logging "1.2.4"
713
:exclusions [org.clojure/clojure]]
814
[com.github.mwiede/jsch "0.2.9"]

0 commit comments

Comments
 (0)