Skip to content

Commit 3f10cdd

Browse files
authored
Merge pull request #1597 from webauthn4j/automate-release-workflow
Automate release workflow
2 parents cbe2183 + 5211678 commit 3f10cdd

File tree

6 files changed

+264
-62
lines changed

6 files changed

+264
-62
lines changed

.github/workflows/bump-version.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
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@v1
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: Update versions in documents
49+
run: |
50+
./gradlew updateVersionsInDocuments
51+
52+
- name: Commit changes
53+
run: |
54+
git config user.name "webauthn4j-bot"
55+
git config user.email "info@webauthn4j.com"
56+
git add .
57+
git commit -m "Bump patch version"
58+
59+
- name: Push commit
60+
run: |
61+
git push

.github/workflows/release.yml

Lines changed: 49 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,68 @@
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: [windows-latest]
10+
release:
11+
permissions:
12+
contents: write
13+
14+
runs-on: windows-latest
1615

1716
steps:
17+
- name: Generate GitHub App(webauthn4j-github-app-bot) Token
18+
id: app-token
19+
uses: actions/create-github-app-token@v1
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+
2840
- name: Build with Gradle
2941
run: |
30-
./gradlew build javadoc asciidoc -PfailBuildOnCVSS=4
42+
./gradlew build javadoc asciidoc
43+
44+
- name: Commit changes
45+
run: |
46+
VERSION=$(grep "webAuthn4JCTAPVersion" gradle.properties | cut -d'=' -f2)
47+
git config user.name "webauthn4j-bot"
48+
git config user.email "info@webauthn4j.com"
49+
git add .
50+
git commit --allow-empty -m "Release ${VERSION}"
51+
52+
- name: Push commit
53+
run: |
54+
git push
55+
56+
- name: Tag commit
57+
run: |
58+
VERSION=$(grep "webAuthn4JSpringSecurityVersion" gradle.properties | cut -d'=' -f2)
59+
git tag "${VERSION}.RELEASE"
60+
61+
- name: Push tag
62+
run: |
63+
VERSION=$(grep "webAuthn4JSpringSecurityVersion" gradle.properties | cut -d'=' -f2)
64+
git push origin "${VERSION}.RELEASE"
65+
3166
3267
- name: Publish to Maven Central
3368
env:
@@ -36,4 +71,4 @@ jobs:
3671
PGP_SIGNING_KEY: ${{ secrets.PGP_SIGNING_KEY }}
3772
PGP_SIGNING_KEY_PASSPHRASE: ${{ secrets.PGP_SIGNING_KEY_PASSPHRASE }}
3873
run: |
39-
./gradlew publishStandardPublicationToMavenCentralRepository
74+
./gradlew publishStandardPublicationToLocalStagingRepository jreleaserDeploy

.github/workflows/snapshot-release.yml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,30 @@ on:
44
push:
55
branches:
66
- master
7+
env:
8+
JAVA_VERSION: 17
79

810
jobs:
911
build:
1012
name: Build
11-
runs-on: ${{ matrix.os }}
12-
strategy:
13-
matrix:
14-
java_version: [17]
15-
os: [windows-latest]
13+
runs-on: windows-latest
1614

1715
steps:
1816
- name: Checkout
1917
uses: actions/checkout@v4
2018

21-
- name: Set up JDK ${{ matrix.java_version }}
19+
- name: Set up JDK ${{ env.JAVA_VERSION }}
2220
uses: actions/setup-java@v4
2321
with:
2422
distribution: 'temurin'
25-
java-version: ${{ matrix.java_version }}
23+
java-version: ${{ env.JAVA_VERSION }}
2624
cache: 'gradle'
2725

2826
- name: Build with Gradle
2927
run: |
30-
./gradlew build -PfailBuildOnCVSS=4
28+
./gradlew build
3129
32-
- name: Publish to oss.sonatype.org snapshot
30+
- name: Publish to central.sonatype.com snapshot
3331
env:
3432
MAVEN_CENTRAL_USER: ${{ secrets.MAVEN_CENTRAL_USER }}
3533
MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}

0 commit comments

Comments
 (0)