Skip to content

Commit ee32853

Browse files
authored
Deploy build (#149)
1 parent 6352e2c commit ee32853

File tree

3 files changed

+68
-2
lines changed

3 files changed

+68
-2
lines changed

.github/workflows/clojure.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,46 @@ jobs:
4444
lein: latest
4545
- name: Run tests
4646
run: lein do clean, all midje, all check
47+
deploy:
48+
concurrency: deploy
49+
needs: test
50+
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
51+
runs-on: ubuntu-latest
52+
steps:
53+
- name: Checkout
54+
uses: actions/checkout@v2
55+
- name: Maven Cache
56+
id: maven-cache
57+
uses: actions/cache@v3
58+
with:
59+
path: |
60+
~/.m2/repository
61+
~/.gitlibs
62+
key: m2-cache-${{ env.ACTIONS_CACHE_VERSION }}-${{ hashFiles('project.clj') }}-${{ matrix.jdk }}
63+
restore-keys: |
64+
m2-cache-${{ env.ACTIONS_CACHE_VERSION }}-${{ hashFiles('project.clj') }}-
65+
m2-cache-${{ env.ACTIONS_CACHE_VERSION }}-
66+
- name: Prepare java
67+
uses: actions/setup-java@v2
68+
with:
69+
distribution: 'adopt'
70+
java-version: '11'
71+
- name: Configure settings.xml
72+
run: |
73+
mkdir -p ~/.m2
74+
echo "<settings><servers><server></id><username>${{ secrets.CLOJARS_USER }}</username><password>${{ secrets.CLOJARS_TOKEN }}</password></server></servers></settings>" > ~/.m2/settings.xml
75+
- name: deploy
76+
env:
77+
COMMIT_MSG: ${{ github.event.head_commit.message }}
78+
run: |
79+
if [[ "$COMMIT_MSG" == "Release :major" ]]; then
80+
lein release :major
81+
elif [[ "$COMMIT_MSG" == "Release :minor" ]]; then
82+
lein release :minor
83+
elif [[ "$COMMIT_MSG" == "Release :patch" ]]; then
84+
lein release :patch
85+
else
86+
lein deploy snapshot
87+
fi
88+
- run: rm -f ~/.m2/settings.xml
89+
if: ${{ always() }}

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,16 @@ One can add extra meta-data, including descriptions to schema elements using `ri
442442
; :additionalProperties false}}
443443
```
444444
445+
## Release process
446+
447+
To release a version, set the project.clj version to the one you want to release, but with a `-SNAPSHOT` suffix.
448+
449+
Then create a commit reading "Release :{major,minor,patch}" based on whether
450+
you want the next development version to be a major/minor/patch increment.
451+
452+
Push to master, and the GitHub Actions release will release the jar to clojars, then bump the version
453+
on the master branch.
454+
445455
## License
446456
447457
Copyright © 2014-2018 [Metosin Oy](http://www.metosin.fi)

project.clj

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
(defproject metosin/ring-swagger "0.26.2"
1+
(defproject metosin/ring-swagger "0.26.3-SNAPSHOT"
22
:description "Swagger Spec for Ring Apps"
33
:url "https://github.com/metosin/ring-swagger"
44
:license {:name "Eclipse Public License"
@@ -35,6 +35,19 @@
3535
:target "gh-pages/doc"
3636
:src-uri "http://github.com/metosin/ring-swagger/blob/master/"
3737
:src-uri-prefix "#L"}
38-
:deploy-repositories [["releases" :clojars]]
38+
:deploy-repositories [["snapshot" {:url "https://clojars.org/repo"
39+
:sign-releases false}]
40+
["release" {:url "https://clojars.org/repo"
41+
:sign-releases false}]]
42+
:release-tasks [["clean"]
43+
["vcs" "assert-committed"]
44+
["change" "version" "leiningen.release/bump-version" "release"]
45+
["vcs" "commit"]
46+
["vcs" "tag" "--no-sign"]
47+
["deploy" "release"]
48+
["change" "version" "leiningen.release/bump-version"]
49+
["vcs" "commit"]
50+
["vcs" "push"]]
51+
3952
:aliases {"all" ["with-profile" "dev:dev,1.7:dev,1.9:dev,1.10:dev,1.11:dev,1.12"]
4053
"test-ancient" ["midje"]})

0 commit comments

Comments
 (0)