Skip to content

Commit

Permalink
Setup automagic deploys
Browse files Browse the repository at this point in the history
  • Loading branch information
slipset committed Aug 10, 2023
1 parent 7e3ad60 commit 7dd9be8
Show file tree
Hide file tree
Showing 2 changed files with 102 additions and 1 deletion.
95 changes: 95 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,22 @@
version: 2.1

workflows:
build-deploy:
jobs:
- build:
filters:
tags:
only: /.*/

- deploy:
requires:
- build
filters:
tags:
only: /Release-.*/
context:
- CLOJARS_DEPLOY

jobs:
build:
machine:
Expand Down Expand Up @@ -58,3 +76,80 @@ jobs:
- run:
name: Run tests
command: lein test

deploy:
machine:
image: ubuntu-2004:2023.07.1

resource_class: medium

working_directory: ~/repo

environment:
LEIN_ROOT: "true"
# Customize the JVM maximum heap limit
JVM_OPTS: -Xmx3200m

steps:
- checkout

- run:
name: Setup environment
command: sudo apt-get update && sudo apt-get install -y openjdk-8-jdk leiningen

# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum "project.clj" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-

# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum "project.clj" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-

- run:
name: Install babashka
command: |
curl -s https://raw.githubusercontent.com/borkdude/babashka/master/install -o install.sh
bash install.sh
rm install.sh
- run:
name: Install deployment-script
command: |
curl -s https://raw.githubusercontent.com/clj-commons/infra/main/deployment/circle-maybe-deploy.bb -o circle-maybe-deploy.bb
chmod a+x circle-maybe-deploy.bb
- run: lein deps

- run:
name: Setup GPG signing key
command: |
apt-get update
apt-get install -y make gnupg
GNUPGHOME="$HOME/.gnupg"
export GNUPGHOME
mkdir -p "$GNUPGHOME"
chmod 0700 "$GNUPGHOME"
echo "$GPG_KEY" \
| base64 --decode --ignore-garbage \
| gpg --batch --allow-secret-key-import --import
gpg --keyid-format LONG --list-secret-keys
- save_cache:
paths:
- ~/.m2
key: v1-dependencies-{{ checksum "project.clj" }}
- run:
name: Deploy
command: |
GPG_TTY=$(tty)
export GPG_TTY
echo $GPG_TTY
./circle-maybe-deploy.bb lein deploy clojars
8 changes: 7 additions & 1 deletion project.clj
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
(defproject clj-commons/clj-ssh "0.6.0-SNAPSHOT"
(defproject org.clj-commons/clj-ssh
(or (System/getenv "PROJECT_VERSION") "0.6.0-SNAPSHOT")
:description "Library for using SSH from clojure."
:url "https://github.com/clj-commons/clj-ssh"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:deploy-repositories [["clojars" {:url "https://repo.clojars.org"
:username :env/clojars_username
:password :env/clojars_org_clj_commons_password
:sign-releases true}]]

:dependencies [[org.clojure/tools.logging "1.2.4"
:exclusions [org.clojure/clojure]]
[com.github.mwiede/jsch "0.2.9"]
Expand Down

0 comments on commit 7dd9be8

Please sign in to comment.