Skip to content

Commit

Permalink
Merge pull request #2 from yetanalytics/test-deploy
Browse files Browse the repository at this point in the history
Test Clojars deployment
  • Loading branch information
kelvinqian00 authored Jan 19, 2024
2 parents a03f745 + c5ea05e commit d0efcf0
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 3 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: CD

on:
push:
tags:
- 'v*'

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Get an env
uses: yetanalytics/action-setup-env@v1

- name: Extract version
id: version
run: echo version=${GITHUB_REF#refs\/tags\/v} >> $GITHUB_OUTPUT

- name: Build JAR
run: make build VERSION=${{ steps.version.outputs.version }} GITHUB_SHA=${{ github.sha }}

- name: Deploy to Clojars
run: make deploy VERSION=${{ steps.version.outputs.version }}
env:
CLOJARS_USERNAME: ${{ secrets.CLOJARS_USERNAME }}
CLOJARS_PASSWORD: ${{ secrets.CLOJARS_DEPLOY_TOKEN }}
8 changes: 6 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ on:
push:
branches:
- '*'
tags:
- 'v*'

jobs:
test-build:
Expand All @@ -19,3 +17,9 @@ jobs:

- name: Test build
run: make test-build

- name: Test deploy
run: make test-deploy
env:
CLOJARS_USERNAME: ${{ secrets.CLOJARS_USERNAME }}
CLOJARS_PASSWORD: ${{ secrets.CLOJARS_DEPLOY_TOKEN }}
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
.PHONY: clean test-build test-deploy
.PHONY: clean test-build test-deploy build deploy

clean:
rm -rf target

test-build:
clojure -X:build :artifact-id '"clojars-build"' :version '"LATEST-SNAPSHOT"' :src-dirs '["src/main"]' :resource-dirs [] :github-repo '"yetanalytics/clojars-build"' :github-sha '"c49ec39b56e114aa63b4517df729846be0c75e0a"'

build:
clojure -X:build :artifact-id '"clojars-build"' :version '"$(VERSION)"' :src-dirs '["src/main"]' :resource-dirs [] :github-repo '"yetanalytics/clojars-build"' :github-sha '"$(GITHUB_SHA)"'

test-deploy:
clojure -X:deploy :artifact-id '"clojars-build"' :version '"LATEST-SNAPSHOT"'

deploy:
clojure -X:deploy :artifact-id '"clojars-build"' :version '"$(VERSION)"'

0 comments on commit d0efcf0

Please sign in to comment.