Skip to content

Commit 0324a89

Browse files
authored
Merge pull request #1129 from webauthn4j/automate-release-workflow
Automate release workflow
2 parents 1934c8a + ffb2e64 commit 0324a89

6 files changed

Lines changed: 259 additions & 46 deletions

File tree

.github/workflows/bump-version.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Bump version
2+
3+
on:
4+
workflow_dispatch:
5+
workflow_run:
6+
workflows: [release]
7+
types: [completed]
8+
9+
env:
10+
JAVA_VERSION: 17
11+
12+
jobs:
13+
bump-version:
14+
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }}
15+
permissions:
16+
contents: write
17+
18+
runs-on: ubuntu-24.04
19+
20+
steps:
21+
- name: Generate GitHub App(webauthn4j-github-app-bot) Token
22+
id: app-token
23+
uses: actions/create-github-app-token@v2
24+
with:
25+
app-id: ${{ secrets.BOT_APP_ID }}
26+
private-key: ${{ secrets.BOT_PRIVATE_KEY }}
27+
28+
- name: Checkout
29+
uses: actions/checkout@v4
30+
with:
31+
token: ${{ steps.app-token.outputs.token }}
32+
33+
- name: Set up JDK ${{ env.JAVA_VERSION }}
34+
uses: actions/setup-java@v4
35+
with:
36+
distribution: 'temurin'
37+
java-version: ${{ env.JAVA_VERSION }}
38+
cache: 'gradle'
39+
40+
- name: Bump patch version
41+
run: |
42+
./gradlew bumpPatchVersion
43+
44+
- name: Switch to snapshot
45+
run: |
46+
./gradlew switchToSnapshot
47+
48+
- name: Commit changes
49+
run: |
50+
git config user.name "webauthn4j-bot"
51+
git config user.email "[email protected]"
52+
git add .
53+
git commit -m "Bump patch version"
54+
55+
- name: Push commit
56+
run: |
57+
git fetch
58+
git rebase origin/master
59+
git push

.github/workflows/pr-gate-ci.yml

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@ name: Pull Request Gate CI
22

33
on: pull_request
44

5+
env:
6+
JAVA_VERSION: 17
7+
58
jobs:
69
build:
710
name: Build
8-
runs-on: ${{ matrix.os }}
11+
runs-on: ubuntu-24.04
912
strategy:
1013
matrix:
1114
java_version: [17]
@@ -15,11 +18,11 @@ jobs:
1518
- name: Checkout
1619
uses: actions/checkout@v4
1720

18-
- name: Set up JDK ${{ matrix.java_version }}
21+
- name: Set up JDK ${{ env.JAVA_VERSION }}
1922
uses: actions/setup-java@v4
2023
with:
2124
distribution: 'temurin'
22-
java-version: ${{ matrix.java_version }}
25+
java-version: ${{ env.JAVA_VERSION }}
2326
cache: 'gradle'
2427

2528
- name: Build with Gradle
@@ -49,21 +52,17 @@ jobs:
4952

5053
code-analysis:
5154
name: Code Analysis
52-
runs-on: ${{ matrix.os }}
53-
strategy:
54-
matrix:
55-
java_version: [17]
56-
os: [ubuntu-24.04]
55+
runs-on: ubuntu-24.04
5756

5857
steps:
5958
- name: Checkout
6059
uses: actions/checkout@v4
6160

62-
- name: Set up JDK ${{ matrix.java_version }}
61+
- name: Set up JDK ${{ env.JAVA_VERSION }}
6362
uses: actions/setup-java@v4
6463
with:
6564
distribution: 'temurin'
66-
java-version: ${{ matrix.java_version }}
65+
java-version: ${{ env.JAVA_VERSION }}
6766
cache: 'gradle'
6867

6968
- name: Build with Gradle

.github/workflows/release.yml

Lines changed: 61 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,80 @@
11
name: Release
22

33
on:
4-
push:
5-
tags:
6-
- '*'
4+
workflow_dispatch:
5+
6+
env:
7+
JAVA_VERSION: 17
78

89
jobs:
9-
build:
10-
name: Build
11-
runs-on: ${{ matrix.os }}
12-
strategy:
13-
matrix:
14-
java_version: [17]
15-
os: [ubuntu-24.04]
10+
release:
11+
permissions:
12+
contents: write
13+
14+
runs-on: ubuntu-24.04
1615

1716
steps:
17+
- name: Generate GitHub App(webauthn4j-github-app-bot) Token
18+
id: app-token
19+
uses: actions/create-github-app-token@v2
20+
with:
21+
app-id: ${{ secrets.BOT_APP_ID }}
22+
private-key: ${{ secrets.BOT_PRIVATE_KEY }}
23+
1824
- name: Checkout
1925
uses: actions/checkout@v4
26+
with:
27+
token: ${{ steps.app-token.outputs.token }}
2028

21-
- name: Set up JDK ${{ matrix.java_version }}
29+
- name: Set up JDK ${{ env.JAVA_VERSION }}
2230
uses: actions/setup-java@v4
2331
with:
2432
distribution: 'temurin'
25-
java-version: ${{ matrix.java_version }}
33+
java-version: ${{ env.JAVA_VERSION }}
2634
cache: 'gradle'
2735

36+
- name: Switch to release
37+
run: |
38+
./gradlew switchToRelease
39+
40+
- name: Update versions in documents
41+
run: |
42+
./gradlew updateVersionsInDocuments
43+
2844
- name: Build with Gradle
2945
run: |
30-
./gradlew build javadoc generateReferenceEN generateReferenceJA -PfailBuildOnCVSS=4
46+
./gradlew build javadoc generateReferenceEN generateReferenceJA
47+
48+
- name: Commit changes
49+
shell: bash
50+
run: |
51+
VERSION=$(grep "webAuthn4JVersion" gradle.properties | cut -d'=' -f2)
52+
git config user.name "webauthn4j-bot"
53+
git config user.email "[email protected]"
54+
git add .
55+
git commit --allow-empty -m "Release ${VERSION}"
56+
57+
- name: Push commit
58+
shell: bash
59+
run: |
60+
git fetch
61+
git rebase origin/master
62+
git push
63+
64+
- name: Tag commit
65+
shell: bash
66+
run: |
67+
VERSION=$(grep "webAuthn4JVersion" gradle.properties | cut -d'=' -f2)
68+
git tag "${VERSION}.RELEASE"
69+
70+
- name: Push tag
71+
shell: bash
72+
run: |
73+
VERSION=$(grep "webAuthn4JVersion" gradle.properties | cut -d'=' -f2)
74+
git fetch
75+
git rebase origin/master
76+
git push origin "${VERSION}.RELEASE"
77+
3178
3279
- name: Publish to Maven Central
3380
env:
@@ -36,4 +83,4 @@ jobs:
3683
PGP_SIGNING_KEY: ${{ secrets.PGP_SIGNING_KEY }}
3784
PGP_SIGNING_KEY_PASSPHRASE: ${{ secrets.PGP_SIGNING_KEY_PASSPHRASE }}
3885
run: |
39-
./gradlew publishStandardPublicationToMavenCentralRepository
86+
./gradlew publishStandardPublicationToLocalStagingRepository jreleaserDeploy

.github/workflows/snapshot-release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ jobs:
2727

2828
- name: Build with Gradle
2929
run: |
30-
./gradlew build javadoc generateReferenceEN generateReferenceJA -PfailBuildOnCVSS=4
30+
./gradlew build javadoc generateReferenceEN generateReferenceJA
3131
32-
- name: Publish to oss.sonatype.org snapshot
32+
- name: Publish to central.sonatype.com snapshot
3333
env:
3434
MAVEN_CENTRAL_USER: ${{ secrets.MAVEN_CENTRAL_USER }}
3535
MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}

0 commit comments

Comments
 (0)