Skip to content

Commit 12afbb4

Browse files
committed
#initial-commit
1 parent 41680e0 commit 12afbb4

File tree

2 files changed

+23
-17
lines changed

2 files changed

+23
-17
lines changed
Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,40 @@
1-
name: Publish package to the Maven Central Repository
1+
name: Release to Maven Central
2+
23
on:
34
release:
45
types: [created]
6+
57
jobs:
68
publish:
79
runs-on: ubuntu-latest
10+
811
steps:
9-
- uses: actions/checkout@v4
12+
- name: Checkout source code
13+
uses: actions/checkout@v4
1014

11-
- name: Set up Maven Central Repository
15+
- name: Set up Java
1216
uses: actions/setup-java@v4
1317
with:
14-
java-version: '21'
1518
distribution: 'temurin'
19+
java-version: '17'
1620
server-id: central
17-
server-username: MAVEN_USERNAME
18-
server-password: MAVEN_PASSWORD
19-
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
20-
gpg-passphrase: MAVEN_GPG_PASSPHRASE
21+
server-username: MAVEN_CENTRAL_USERNAME
22+
server-password: MAVEN_CENTRAL_TOKEN
23+
24+
- name: Import GPG key
25+
run: |
26+
echo "$GPG_PRIVATE_KEY" | gpg --batch --yes --import
27+
env:
28+
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
29+
30+
- name: Set GPG passphrase
31+
run: echo "MAVEN_GPG_PASSPHRASE=${{ secrets.GPG_PRIVATE_KEY_PASSPHRASE }}" >> $GITHUB_ENV
2132

2233
- name: Set version
2334
run: mvn versions:set -DnewVersion=${{ github.event.release.tag_name }}
2435

25-
- name: Publish package
26-
run: mvn -P release --batch-mode deploy
36+
- name: Publish to Maven Central
37+
run: mvn --batch-mode deploy -P release -Dgpg.passphrase=${{ secrets.GPG_PRIVATE_KEY_PASSPHRASE }}
2738
env:
28-
MAVEN_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
29-
MAVEN_PASSWORD: ${{ secrets.MAVEN_CENTRAL_TOKEN }}
30-
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PRIVATE_KEY_PASSPHRASE }}
39+
MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
40+
MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }}

pom.xml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,6 @@
4141
<profiles>
4242
<profile>
4343
<id>release</id>
44-
<properties>
45-
<gpg.keyname>${env.GPG_KEYNAME}</gpg.keyname>
46-
<gpg.passphrase>${env.GPG_PASSPHRASE}</gpg.passphrase>
47-
</properties>
4844
</profile>
4945
</profiles>
5046

0 commit comments

Comments
 (0)