From d0c0af058000c2033317b9c6ae809ee5125005a7 Mon Sep 17 00:00:00 2001 From: Ambrose Bonnaire-Sergeant Date: Wed, 20 Dec 2023 13:24:46 -0600 Subject: [PATCH] deploy action --- .github/workflows/clojure.yml | 42 ++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/.github/workflows/clojure.yml b/.github/workflows/clojure.yml index 61237b7..fbabe71 100644 --- a/.github/workflows/clojure.yml +++ b/.github/workflows/clojure.yml @@ -3,7 +3,7 @@ name: Run tests on: push: - branches: [test-threadgrid-ci] + branches: [master] pull_request: branches: [master] @@ -44,3 +44,43 @@ jobs: lein: latest - name: Run tests run: lein do clean, all midje, all check + deploy: + concurrency: deploy + needs: test + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Cache local Maven repository + uses: actions/cache@v2 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/project.clj') }} + restore-keys: | + ${{ runner.os }}-maven- + - uses: turtlequeue/setup-babashka@5e0acf2cf146558d93a573e339e1d24f2758adfd + with: + babashka-version: ${{env.BABASHKA_VERSION}} + - name: Prepare java + uses: actions/setup-java@v2 + with: + distribution: 'adopt' + java-version: '11' + - name: deploy + env: + CLOJARS_USER: ${{ secrets.CLOJARS_USER }} + CLOJARS_TOKEN: ${{ secrets.CLOJARS_TOKEN }} + COMMIT_MSG: ${{ github.event.head_commit.message }} + run: | + git config --global user.email "bot@metosin.com" + git config --global user.name "Metosin Automated Release" + if [[ "$COMMIT_MSG" == "Release :major" ]]; then + lein release :major + elif [[ "$COMMIT_MSG" == "Release :minor" ]]; then + lein release :minor + elif [[ "$COMMIT_MSG" == "Release :patch" ]]; then + lein release :patch + else + lein deploy snapshot + fi