Skip to content

Commit 38946c2

Browse files
committed
Automatic action for publishing release artifacts to central
1 parent d650bd2 commit 38946c2

File tree

2 files changed

+27
-3
lines changed

2 files changed

+27
-3
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Publish package release to the Maven Central Repository
2+
on:
3+
release:
4+
types: [published]
5+
6+
jobs:
7+
publish:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v3
11+
- name: Set up Maven Central Repository
12+
uses: actions/setup-java@v3
13+
with:
14+
java-version: '17'
15+
distribution: 'adopt'
16+
server-id: ossrh
17+
server-username: MAVEN_USERNAME
18+
server-password: MAVEN_PASSWORD
19+
gpg-private-key: ${{ secrets.GPG_KEY }}
20+
gpg-passphrase: MAVEN_GPG_PASSPHRASE
21+
- name: Publish package
22+
run: mvn clean deploy -P release
23+
env:
24+
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
25+
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
26+
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}

.github/workflows/deploy-to-central.yml renamed to .github/workflows/deploy-snapshot-central.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
name: Publish package to the Maven Central Repository
1+
name: Publish package snapshot to the Maven Central Repository
22
on:
3-
release:
4-
types: [created]
53
workflow_dispatch:
64

75
jobs:

0 commit comments

Comments
 (0)