Skip to content

Commit 91dceb7

Browse files
authored
Update GitHubActions release job (#3053)
1 parent 0c52fc6 commit 91dceb7

File tree

1 file changed

+29
-14
lines changed

1 file changed

+29
-14
lines changed

.github/workflows/release.yml

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@ on:
33
workflow_dispatch:
44
inputs:
55
release-tag:
6-
description: 'Version to release'
6+
description: 'Tag to release (must start with "v", e.g., v1.2.3)'
77
required: true
88

9+
permissions:
10+
contents: write
11+
912
jobs:
1013
build:
1114
runs-on: ubuntu-latest
@@ -20,24 +23,36 @@ jobs:
2023
with:
2124
ref: ${{ github.event.inputs.release-tag }}
2225

26+
- name: Validate release tag format
27+
run: |
28+
TAG="${{ github.event.inputs.release-tag }}"
29+
30+
if [[ ! "$TAG" =~ ^v[0-9]+(\.[0-9]+)*(-[a-zA-Z0-9]+)?$ ]]; then
31+
echo "❌ Invalid tag format: '${{ github.event.inputs.release-tag }}'"
32+
echo "✅ Tag must start with 'v' and follow semantic versioning (e.g., v1.0.0 or v1.2.3-RC1)"
33+
exit 1
34+
fi
35+
36+
if ! git show-ref --tags --verify --quiet "refs/tags/${TAG}"; then
37+
echo "❌ Tag '$TAG' does not exist in the repository"
38+
exit 1
39+
fi
40+
2341
- name: Setup JDK
2442
uses: actions/setup-java@v4
2543
with:
26-
distribution: 'oracle'
27-
java-version: ${{ matrix.java }}
28-
architecture: ${{ matrix.architecture }}
44+
distribution: 'temurin'
45+
java-version: '21'
2946
cache: 'maven'
30-
server-id: oss.sonatype.org
31-
server-username: MAVEN_USERNAME
32-
server-password: MAVEN_PASSWORD
47+
server-id: central
48+
server-username: CENTRAL_USERNAME
49+
server-password: CENTRAL_PASSWORD
3350
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
34-
gpg-passphrase: MAVEN_GPG_PASSPHRASE
3551

36-
37-
- name: Release with Maven
38-
run: mvn -B --no-transfer-progress -Psonatype-oss-release -Prelease-sign-artifacts -DskipTests=true deploy
52+
- name: Release
53+
run: mvn -B --no-transfer-progress -Pmaven-central-release -DskipTests=true deploy
3954
env:
40-
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
41-
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
55+
CENTRAL_USERNAME: ${{ secrets.CENTRAL_USERNAME }}
56+
CENTRAL_PASSWORD: ${{ secrets.CENTRAL_PASSWORD }}
4257
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
43-
MAVEN_OPTS: "--add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.text=ALL-UNNAMED --add-opens=java.desktop/java.awt.font=ALL-UNNAMED"
58+

0 commit comments

Comments
 (0)