From ee328530337c1b0347c1e30859314d4ec75426fb Mon Sep 17 00:00:00 2001 From: Ambrose Bonnaire-Sergeant Date: Wed, 20 Dec 2023 14:09:10 -0600 Subject: [PATCH] Deploy build (#149) --- .github/workflows/clojure.yml | 43 +++++++++++++++++++++++++++++++++++ README.md | 10 ++++++++ project.clj | 17 ++++++++++++-- 3 files changed, 68 insertions(+), 2 deletions(-) diff --git a/.github/workflows/clojure.yml b/.github/workflows/clojure.yml index df0ebe91..a459e3e6 100644 --- a/.github/workflows/clojure.yml +++ b/.github/workflows/clojure.yml @@ -44,3 +44,46 @@ 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: Maven Cache + id: maven-cache + uses: actions/cache@v3 + with: + path: | + ~/.m2/repository + ~/.gitlibs + key: m2-cache-${{ env.ACTIONS_CACHE_VERSION }}-${{ hashFiles('project.clj') }}-${{ matrix.jdk }} + restore-keys: | + m2-cache-${{ env.ACTIONS_CACHE_VERSION }}-${{ hashFiles('project.clj') }}- + m2-cache-${{ env.ACTIONS_CACHE_VERSION }}- + - name: Prepare java + uses: actions/setup-java@v2 + with: + distribution: 'adopt' + java-version: '11' + - name: Configure settings.xml + run: | + mkdir -p ~/.m2 + echo "${{ secrets.CLOJARS_USER }}${{ secrets.CLOJARS_TOKEN }}" > ~/.m2/settings.xml + - name: deploy + env: + COMMIT_MSG: ${{ github.event.head_commit.message }} + run: | + 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 + - run: rm -f ~/.m2/settings.xml + if: ${{ always() }} diff --git a/README.md b/README.md index d4a83f88..e2380969 100644 --- a/README.md +++ b/README.md @@ -442,6 +442,16 @@ One can add extra meta-data, including descriptions to schema elements using `ri ; :additionalProperties false}} ``` +## Release process + +To release a version, set the project.clj version to the one you want to release, but with a `-SNAPSHOT` suffix. + +Then create a commit reading "Release :{major,minor,patch}" based on whether +you want the next development version to be a major/minor/patch increment. + +Push to master, and the GitHub Actions release will release the jar to clojars, then bump the version +on the master branch. + ## License Copyright © 2014-2018 [Metosin Oy](http://www.metosin.fi) diff --git a/project.clj b/project.clj index dff3cab0..bacf3f62 100644 --- a/project.clj +++ b/project.clj @@ -1,4 +1,4 @@ -(defproject metosin/ring-swagger "0.26.2" +(defproject metosin/ring-swagger "0.26.3-SNAPSHOT" :description "Swagger Spec for Ring Apps" :url "https://github.com/metosin/ring-swagger" :license {:name "Eclipse Public License" @@ -35,6 +35,19 @@ :target "gh-pages/doc" :src-uri "http://github.com/metosin/ring-swagger/blob/master/" :src-uri-prefix "#L"} - :deploy-repositories [["releases" :clojars]] + :deploy-repositories [["snapshot" {:url "https://clojars.org/repo" + :sign-releases false}] + ["release" {:url "https://clojars.org/repo" + :sign-releases false}]] + :release-tasks [["clean"] + ["vcs" "assert-committed"] + ["change" "version" "leiningen.release/bump-version" "release"] + ["vcs" "commit"] + ["vcs" "tag" "--no-sign"] + ["deploy" "release"] + ["change" "version" "leiningen.release/bump-version"] + ["vcs" "commit"] + ["vcs" "push"]] + :aliases {"all" ["with-profile" "dev:dev,1.7:dev,1.9:dev,1.10:dev,1.11:dev,1.12"] "test-ancient" ["midje"]})