Skip to content

Commit 5958cf4

Browse files
committed
add maven-central-publish-workflow
1 parent 858d536 commit 5958cf4

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

.github/workflows/publish-central.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Publish to Maven Central
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
tag:
6+
description: 'Tag'
7+
required: true
8+
default: '0.0.0'
9+
jobs:
10+
publish:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v2
14+
with:
15+
ref: "refs/tags/${{ github.event.inputs.tag }}"
16+
- uses: actions/setup-java@v1
17+
with:
18+
java-version: 11
19+
server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml
20+
server-username: MAVEN_USERNAME # env variable for username in deploy
21+
server-password: MAVEN_PASSWORD # env variable for token in deploy
22+
gpg-private-key: ${{ secrets.RELEASES_GPG_PRIVATE_KEY }} # Value of the GPG private key to import
23+
gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase
24+
- uses: actions/cache@v2
25+
with:
26+
path: ~/.m2/repository
27+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
28+
restore-keys: |
29+
${{ runner.os }}-maven-
30+
- name: Enforce project version ${{ github.event.inputs.tag }}
31+
run: mvn versions:set -B -DnewVersion=${{ github.event.inputs.tag }}
32+
- name: Deploy
33+
run: mvn deploy -B -DskipTests -Psign,deploy-central --no-transfer-progress
34+
env:
35+
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
36+
MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
37+
MAVEN_GPG_PASSPHRASE: ${{ secrets.RELEASES_GPG_PASSPHRASE }}

0 commit comments

Comments
 (0)