Skip to content

Commit 9af380b

Browse files
author
Dennis Kieselhorst
authored
Create GitHub action to automate releases
1 parent 85bcf3d commit 9af380b

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

.github/workflows/release.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Publish package to the Maven Central Repository
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
releaseVersion:
6+
description: "Version to use for the release."
7+
required: true
8+
default: "X.Y.Z"
9+
developmentVersion:
10+
description: "Version to use for further development"
11+
required: true
12+
default: "X.Y.Z-SNAPSHOT"
13+
jobs:
14+
release:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v2
18+
- name: Set up Maven
19+
uses: actions/setup-java@v2
20+
with:
21+
distribution: 'temurin' # Corretto isn't supported right now https://github.com/actions/setup-java/issues/68
22+
java-version: 8
23+
server-id: sonatype-nexus-staging
24+
server-username: MAVEN_USERNAME
25+
server-password: MAVEN_PASSWORD
26+
gpg-private-key: ${{ secrets.GPG_SIGNING_KEY }} # Value of the GPG private key to import
27+
gpg-passphrase: GPG_PASSPHRASE # env variable for GPG private key passphrase
28+
- name: Release and publish package
29+
run: mvn release:prepare release:perform -B -DreleaseVersion=${{ github.event.inputs.releaseVersion }} -DdevelopmentVersion=${{ github.event.inputs.developmentVersion }}
30+
env:
31+
MAVEN_USERNAME: ${{ secrets.OSSRH_JIRA_USERNAME }}
32+
MAVEN_PASSWORD: ${{ secrets.OSSRH_JIRA_PASSWORD }}
33+
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}

0 commit comments

Comments
 (0)