-
Notifications
You must be signed in to change notification settings - Fork 574
45 lines (44 loc) · 1.91 KB
/
release.yml
File metadata and controls
45 lines (44 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
name: Publish package to the Maven Central Repository
on:
workflow_dispatch:
inputs:
releaseVersion:
description: "Version to use for the release."
required: true
default: "X.Y.Z"
developmentVersion:
description: "Version to use for further development"
required: true
default: "X.Y.Z-SNAPSHOT"
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Configure Git User # may be removed after https://github.com/actions/checkout/issues/13 is resolved
run: |
git config user.email "${{ github.actor }}@users.noreply.github.com"
git config user.name "${{ github.actor }}"
- name: Set up Maven
uses: actions/setup-java@v3
with:
distribution: 'corretto'
java-version: 17
server-id: sonatype-central-staging
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.GPG_SIGNING_KEY }} # Value of the GPG private key to import
gpg-passphrase: GPG_PASSPHRASE # env variable for GPG private key passphrase
- name: Release and publish package
run: mvn release:prepare release:perform -B -DreleaseVersion=${{ github.event.inputs.releaseVersion }} -DdevelopmentVersion=${{ github.event.inputs.developmentVersion }}
env:
MAVEN_USERNAME: ${{ secrets.CENTRAL_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.CENTRAL_PASSWORD }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
- name: Upload to Central Publisher Portal
run: |
AUTH=$(echo -n "${{ secrets.CENTRAL_USERNAME }}:${{ secrets.CENTRAL_PASSWORD }}" | base64)
curl --fail -X POST "https://ossrh-staging-api.central.sonatype.com/manual/upload/defaultRepository/com.amazonaws.serverless" \
-H "Authorization: Bearer $AUTH"