44 workflow_dispatch :
55 inputs :
66 version :
7- description : " Release version"
7+ description : ' Release version'
88 required : true
99
10+ env :
11+ JAVA_VERSION : ' 11'
12+ JAVA_DISTRO : ' zulu'
13+
1014jobs :
11- version :
12- name : Version
15+ precheck :
16+ name : Precheck
1317 runs-on : ubuntu-latest
14- if : github.repository == 'kordamp/ikonli'
15-
18+ outputs :
19+ VERSION : ${{ steps.vars.outputs.VERSION }}
1620 steps :
17- - uses : actions/checkout@v2
18-
19- - name : Set release version
20- run : |
21- VERSION=${{ github.event.inputs.version }}
22- echo $VERSION > VERSION
23- sed -i -e "s/^\:project-version\:\ .*/:project-version: ${VERSION}/g" README.adoc
24- git add VERSION
25- git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
26- git config --global user.name "GitHub Action"
27- git commit -a -m "Releasing version $VERSION"
28- git push origin master
29- git rev-parse HEAD > HEAD
21+ - name : Checkout
22+ uses : actions/checkout@v2
3023
31- - name : Upload files
32- uses : actions/upload-artifact@v2
24+ - uses : n1hility/cancel-previous-runs@v2
3325 with :
34- name : artifacts
35- path : |
36- HEAD
26+ token : ${{ secrets.GITHUB_TOKEN }}
27+
28+ - name : Version
29+ id : vars
30+ shell : bash
31+ run : |
32+ echo ::set-output name=VERSION::${{ github.event.inputs.version }}
3733
3834 build :
3935 name : Build
40- needs : version
36+ needs : [precheck]
4137 strategy :
4238 fail-fast : false
4339 matrix :
4440 os : [ ubuntu-latest, macos-latest, windows-latest ]
4541 runs-on : ${{ matrix.os }}
4642
4743 steps :
48- - name : Download all artifacts
49- uses : actions/download-artifact@v2
50-
51- - name : Read HEAD ref
52- id : head
53- uses : juliangruber/read-file-action@v1
54- with :
55- path : artifacts/HEAD
56-
5744 - name : Check out repository
5845 uses : actions/checkout@v2
59- with :
60- ref : ${{ steps.head.outputs.content }}
6146
62- - name : Set up Java
47+ - name : Setup Java
6348 uses : actions/setup-java@v2
6449 with :
65- java-version : 11
66- distribution : ' zulu '
50+ java-version : ${{ env.JAVA_VERSION }}
51+ distribution : ${{ env.JAVA_DISTRO }}
6752
6853 - uses : actions/cache@v2
6954 with :
7055 path : ~/.gradle/caches
71- key : ${{ runner.os }}-gradle-cache- ${{ hashFiles('**/*.gradle') }}-${{ hashFiles('**/gradle.properties') }}
56+ key : ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}-${{ hashFiles('**/gradle.properties') }}
7257 restore-keys : |
7358 ${{ runner.os }}-gradle-
7459
7560 - uses : actions/cache@v2
7661 with :
7762 path : ~/.gradle/wrapper
78- key : ${{ runner.os }}-gradle-wrapper -${{ hashFiles('**/gradlew') }}
63+ key : ${{ runner.os }}-gradlew -${{ hashFiles('**/gradlew') }}
7964 restore-keys : |
8065 ${{ runner.os }}-gradlew-
8166
67+ - name : Version
68+ run : |
69+ echo ${{ needs.precheck.outputs.VERSION }} > VERSION
70+
8271 - name : Build
8372 run : ./gradlew -Prelease=true build
8473
85- - name : Jlink & JPackage
86- run : ' ./gradlew -Prelease=true :ikonli-browser:jlinkZip :ikonli-browser:jpackage'
74+ - name : Assemble
75+ run : ./gradlew -Prelease=true :ikonli-browser:jlinkZip :ikonli-browser:jpackage
8776
8877 - name : Upload artifacts
8978 uses : actions/upload-artifact@v2
@@ -101,33 +90,46 @@ jobs:
10190
10291 release :
10392 name : Release
104- needs : build
93+ needs : [precheck, build]
10594 runs-on : ubuntu-latest
10695 steps :
107- # must read HEAD before checkout
108- - name : Download build artifacts
109- uses : actions/download-artifact@v2
110-
111- - name : Read HEAD ref
112- id : head
113- uses : juliangruber/read-file-action@v1
114- with :
115- path : artifacts/HEAD
116-
11796 - name : Checkout
11897 uses : actions/checkout@v2
11998 with :
120- ref : ${{ steps.head.outputs.content }}
12199 fetch-depth : 0
122100
123101 - name : Download build artifacts
124102 uses : actions/download-artifact@v2
125103
126- - name : Set up Java
104+ - name : Setup Java
127105 uses : actions/setup-java@v2
128106 with :
129- java-version : 11
130- distribution : ' zulu'
107+ java-version : ${{ env.JAVA_VERSION }}
108+ distribution : ${{ env.JAVA_DISTRO }}
109+
110+ - uses : actions/cache@v2
111+ with :
112+ path : ~/.gradle/caches
113+ key : ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}-${{ hashFiles('**/gradle.properties') }}
114+ restore-keys : |
115+ ${{ runner.os }}-gradle-
116+
117+ - uses : actions/cache@v2
118+ with :
119+ path : ~/.gradle/wrapper
120+ key : ${{ runner.os }}-gradlew-${{ hashFiles('**/gradlew') }}
121+ restore-keys : |
122+ ${{ runner.os }}-gradlew-
123+
124+ - name : Version
125+ run : |
126+ echo ${{ needs.precheck.outputs.VERSION }} > VERSION
127+ git add VERSION
128+ sed -i -e "s/^\:project-version\:\ .*/:project-version: ${{ needs.precheck.outputs.VERSION }}/g" README.adoc
129+ git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
130+ git config --global user.name "GitHub Action"
131+ git commit -a -m "Releasing version ${{ needs.precheck.outputs.VERSION }}"
132+ git push origin master
131133
132134 - name : Deploy
133135 env :
@@ -138,14 +140,14 @@ jobs:
138140 ./gradlew -Prelease=true -Pfull-release=true \
139141 -PsonatypeUsername=${{ secrets.SONATYPE_USERNAME }} \
140142 -PsonatypePassword=${{ secrets.SONATYPE_PASSWORD }} \
141- build publishToSonatype closeAndReleaseSonatypeStagingRepository -S
143+ build :ikonli-bom:publishToSonatype publishToSonatype closeAndReleaseSonatypeStagingRepository -S
142144
143145 - name : Release
144146 uses : jreleaser/release-action@v1
145147 with :
146148 arguments : full-release -P artifactsDir=artifacts
147149 env :
148- JRELEASER_PROJECT_VERSION : ${{ github.event.inputs.version }}
150+ JRELEASER_PROJECT_VERSION : ${{ needs.precheck.outputs.VERSION }}
149151 JRELEASER_GITHUB_TOKEN : ${{ secrets.GIT_ACCESS_TOKEN }}
150152 JRELEASER_GPG_PASSPHRASE : ${{ secrets.GPG_PASSPHRASE }}
151153 JRELEASER_GPG_PUBLIC_KEY : ${{ secrets.GPG_PUBLIC_KEY }}
@@ -155,11 +157,11 @@ jobs:
155157 JRELEASER_TWITTER_ACCESS_TOKEN : ${{ secrets.TWITTER_ACCESS_TOKEN }}
156158 JRELEASER_TWITTER_ACCESS_TOKEN_SECRET : ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }}
157159
158- - name : JReleaser output
160+ - name : JReleaser release output
159161 if : always()
160162 uses : actions/upload-artifact@v2
161163 with :
162- name : artifact
164+ name : jreleaser-release
163165 path : |
164166 out/jreleaser/trace.log
165- out/jreleaser/output.properties
167+ out/jreleaser/output.properties
0 commit comments