Skip to content

Commit fb5e6c0

Browse files
Update maven-publish.yml
1 parent 13fbd78 commit fb5e6c0

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed
Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created
2-
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#apache-maven-with-a-settings-path
3-
4-
name: Maven Package
1+
name: Publish package to the Maven Central Repository
52

63
on:
74
release:
@@ -17,18 +14,27 @@ jobs:
1714

1815
steps:
1916
- uses: actions/checkout@v4
20-
- name: Set up JDK 23
17+
- name: Set up Maven Central Repository
2118
uses: actions/setup-java@v4
2219
with:
2320
java-version: '23'
2421
distribution: 'temurin'
25-
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
26-
settings-path: ${{ github.workspace }} # location for the settings.xml file
22+
server-id: central
23+
server-username: MAVEN_USERNAME
24+
server-password: MAVEN_PASSWORD
25+
gpg-private-key: ${{ secrets.GPG_SIGNING_KEY }}
26+
gpg-passphrase: MAVEN_GPG_PASSPHRASE
27+
28+
- name: Set version
29+
run: mvn versions:set -DnewVersion=${{ github.event.release.tag_name }}
2730

2831
- name: Build with Maven
2932
run: mvn -B package --file pom.xml
3033

31-
- name: Publish to GitHub Packages Apache Maven
32-
run: mvn deploy -s $GITHUB_WORKSPACE/settings.xml
34+
- name: Publish package
35+
run: mvn -P release --batch-mode deploy -DskipTests
36+
3337
env:
34-
GITHUB_TOKEN: ${{ github.token }}
38+
MAVEN_USERNAME: ${{ secrets.CENTRAL_TOKEN_USERNAME }}
39+
MAVEN_PASSWORD: ${{ secrets.CENTRAL_TOKEN_PASSWORD }}
40+
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_SIGNING_KEY_PASSWORD }}

0 commit comments

Comments
 (0)