Skip to content

Commit

Permalink
WIP: Add deploy step to CI
Browse files Browse the repository at this point in the history
  • Loading branch information
totakke committed Feb 6, 2024
1 parent 5f108e5 commit 0403f87
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,45 @@ jobs:

- name: Run tests
run: lein with-profile +1.9:+1.10:+1.11 test

get-version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.get-version.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Get version
id: get-version
run: |
echo "version=$(head -n 1 project.clj | sed -e 's/^(defproject.*\"\(.*\)\"$/\1/')" \
>> "$GITHUB_OUTPUT"
deploy:
if: ${{ github.event_name == 'push' &&
github.ref == 'refs/heads/fix/ci' &&
endsWith(needs.get-version.outputs.version, '-SNAPSHOT') }}
needs: [test, get-version]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'

- name: Setup Clojure
uses: DeLaGuardo/setup-clojure@12.3
with:
lein: '2.11.1'

- name: Deploy
env:
CLOJARS_USERNAME: ${{ secrets.CLOJARS_USERNAME }}
CLOJARS_PASSWORD: ${{ secrets.CLOJARS_PASSWORD }}
run: lein deploy snapshots

3 changes: 3 additions & 0 deletions project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,7 @@
:profiles {:1.9 {:dependencies [[org.clojure/clojure "1.9.0"]]}
:1.10 {:dependencies [[org.clojure/clojure "1.10.3"]]}
:1.11 {:dependencies [[org.clojure/clojure "1.11.1"]]}}
:deploy-repositories [["snapshots" {:url "https://clojars.org/repo/"
:username [:env/clojars_username]
:password [:env/clojars_password]}]]
:signing {:gpg-key "roimisia@gmail.com"})

0 comments on commit 0403f87

Please sign in to comment.