Skip to content

Commit

Permalink
Set up auto-deploy (#58)
Browse files Browse the repository at this point in the history
  • Loading branch information
slipset authored Nov 12, 2021
1 parent 6bc8f5f commit 5530bdc
Show file tree
Hide file tree
Showing 2 changed files with 98 additions and 3 deletions.
94 changes: 92 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,30 @@
#
# Check https://circleci.com/docs/2.0/language-clojure/ for more details
#
version: 2
version: 2.1

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

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

jobs:
build:
docker:
# specify the version you desire here
- image: circleci/clojure:lein-2.7.1
- image: circleci/clojure:openjdk-8-lein-2.9.1

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

# run tests!
- run: lein test
deploy:
docker:
# specify the version you desire here
- image: circleci/clojure:openjdk-8-lein-2.9.1
# Specify service dependencies here if necessary
# CircleCI maintains a library of pre-built images
# documented at https://circleci.com/docs/2.0/circleci-images/
# - image: circleci/postgres:9.4

working_directory: ~/repo

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

steps:
- checkout

# 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
sudo 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: |
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
7 changes: 6 additions & 1 deletion project.clj
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
(defproject clj-commons/iapetos "0.1.12"
(defproject clj-commons/iapetos (or (System/getenv "PROJECT_VERSION") "0.1.12")
:description "A Clojure Prometheus Client"
:url "https://github.com/clj-commons/iapetos"
:license {:name "MIT License"
:url "https://opensource.org/licenses/MIT"
:year 2019
:key "mit"}
:deploy-repositories [["clojars" {:url "https://repo.clojars.org"
:username :env/clojars_username
:password :env/clojars_password
:sign-releases true}]]

:dependencies [[org.clojure/clojure "1.10.3" :scope "provided"]
[io.prometheus/simpleclient "0.12.0"]
[io.prometheus/simpleclient_common "0.12.0"]
Expand Down

0 comments on commit 5530bdc

Please sign in to comment.