Skip to content

Commit 47ded1f

Browse files
committed
[build] Update workflow configuration
1 parent f5e5eac commit 47ded1f

File tree

3 files changed

+115
-92
lines changed

3 files changed

+115
-92
lines changed

.github/workflows/build.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ name: Build
33
on:
44
pull_request:
55

6+
env:
7+
JAVA_VERSION: '11'
8+
JAVA_DISTRO: 'zulu'
9+
610
jobs:
711
build:
812
name: Build
@@ -16,25 +20,25 @@ jobs:
1620
steps:
1721
- uses: actions/checkout@v2
1822

19-
- name: Set up Java
23+
- name: Setup Java
2024
uses: actions/setup-java@v2
2125
with:
22-
java-version: 11
23-
distribution: 'zulu'
26+
java-version: ${{ env.JAVA_VERSION }}
27+
distribution: ${{ env.JAVA_DISTRO }}
2428

2529
- uses: actions/cache@v2
2630
with:
2731
path: ~/.gradle/caches
28-
key: ${{ runner.os }}-gradle-cache-${{ hashFiles('**/*.gradle') }}-${{ hashFiles('**/gradle.properties') }}
32+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}-${{ hashFiles('**/gradle.properties') }}
2933
restore-keys: |
3034
${{ runner.os }}-gradle-
3135
3236
- uses: actions/cache@v2
3337
with:
3438
path: ~/.gradle/wrapper
35-
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradlew') }}
39+
key: ${{ runner.os }}-gradlew-${{ hashFiles('**/gradlew') }}
3640
restore-keys: |
3741
${{ runner.os }}-gradlew-
3842
3943
- name: Build
40-
run: ./gradlew build -S
44+
run: ./gradlew build -S

.github/workflows/early-access.yml

Lines changed: 41 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,44 +4,68 @@ on:
44
push:
55
branches: [ master ]
66

7+
env:
8+
JAVA_VERSION: '11'
9+
JAVA_DISTRO: 'zulu'
10+
711
jobs:
12+
precheck:
13+
name: Precheck
14+
if: startsWith(github.event.head_commit.message, 'Releasing version') != true
15+
runs-on: ubuntu-latest
16+
outputs:
17+
VERSION: ${{ steps.vars.outputs.VERSION }}
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v2
21+
22+
- uses: n1hility/cancel-previous-runs@v2
23+
with:
24+
token: ${{ secrets.GITHUB_TOKEN }}
25+
26+
- name: Version
27+
id: vars
28+
shell: bash
29+
run: |
30+
echo ::set-output name=VERSION::$(cat VERSION)
31+
832
build:
933
name: Build
34+
needs: [precheck]
35+
if: endsWith(${{ needs.precheck.outputs.VERSION }}, '-SNAPSHOT')
1036
strategy:
1137
fail-fast: false
1238
matrix:
1339
os: [ ubuntu-latest, macos-latest, windows-latest ]
1440
runs-on: ${{ matrix.os }}
15-
if: github.repository == 'kordamp/ikonli' && startsWith(github.event.head_commit.message, 'Releasing version') != true
16-
1741
steps:
1842
- uses: actions/checkout@v2
1943

20-
- name: Set up Java
44+
- name: Setup Java
2145
uses: actions/setup-java@v2
2246
with:
23-
java-version: 11
24-
distribution: 'zulu'
47+
java-version: ${{ env.JAVA_VERSION }}
48+
distribution: ${{ env.JAVA_DISTRO }}
2549

2650
- uses: actions/cache@v2
2751
with:
2852
path: ~/.gradle/caches
29-
key: ${{ runner.os }}-gradle-cache-${{ hashFiles('**/*.gradle') }}-${{ hashFiles('**/gradle.properties') }}
53+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}-${{ hashFiles('**/gradle.properties') }}
3054
restore-keys: |
3155
${{ runner.os }}-gradle-
3256
3357
- uses: actions/cache@v2
3458
with:
3559
path: ~/.gradle/wrapper
36-
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradlew') }}
60+
key: ${{ runner.os }}-gradlew-${{ hashFiles('**/gradlew') }}
3761
restore-keys: |
3862
${{ runner.os }}-gradlew-
3963
4064
- name: Build
4165
run: ./gradlew -Prelease=true build
4266

43-
- name: Jlink & JPackage
44-
run: './gradlew -Prelease=true :ikonli-browser:jlinkZip :ikonli-browser:jpackage'
67+
- name: Assemble
68+
run: ./gradlew -Prelease=true :ikonli-browser:jlinkZip :ikonli-browser:jpackage
4569

4670
- name: Upload artifacts
4771
uses: actions/upload-artifact@v2
@@ -57,9 +81,9 @@ jobs:
5781
apps/ikonli-browser/build/packagers/ikonli-browser-*.pkg
5882
apps/ikonli-browser/build/packagers/ikonli-browser-*.deb
5983
60-
earlyaccess:
61-
name: EarlyAccess
62-
needs: build
84+
release:
85+
name: Release
86+
needs: [precheck, build]
6387
runs-on: ubuntu-latest
6488
steps:
6589
- name: Checkout
@@ -70,26 +94,19 @@ jobs:
7094
- name: Download build artifacts
7195
uses: actions/download-artifact@v2
7296

73-
- name: Artifacts
74-
run: ls -lR artifacts
75-
76-
- name: Set up Java
97+
- name: Setup Java
7798
uses: actions/setup-java@v2
7899
with:
79-
java-version: 11
80-
distribution: 'zulu'
81-
82-
- name: Version
83-
id: vars
84-
run: echo ::set-output name=version::$(cat VERSION)
100+
java-version: ${{ env.JAVA_VERSION }}
101+
distribution: ${{ env.JAVA_DISTRO }}
85102

86103
- name: Release
87104
uses: jreleaser/release-action@v1
88105
with:
89106
version: early-access
90107
arguments: full-release -P artifactsDir=artifacts
91108
env:
92-
JRELEASER_PROJECT_VERSION: ${{ steps.vars.outputs.version }}
109+
JRELEASER_PROJECT_VERSION: ${{ needs.precheck.outputs.VERSION }}
93110
JRELEASER_GITHUB_TOKEN: ${{ secrets.GIT_ACCESS_TOKEN }}
94111
JRELEASER_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
95112
JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.GPG_PUBLIC_KEY }}
@@ -99,7 +116,7 @@ jobs:
99116
if: always()
100117
uses: actions/upload-artifact@v2
101118
with:
102-
name: jreleaser
119+
name: jreleaser-release
103120
path: |
104121
out/jreleaser/trace.log
105122
out/jreleaser/output.properties

.github/workflows/release.yml

Lines changed: 64 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -4,86 +4,75 @@ on:
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+
1014
jobs:
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

Comments
 (0)