-
Notifications
You must be signed in to change notification settings - Fork 2
45 lines (42 loc) · 1.62 KB
/
maven-release.yaml
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: Release a new version
on:
workflow_dispatch:
inputs:
releaseversion:
type: string
description: 'Version to release'
required: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'oracle'
cache: maven
server-id: central
server-username: MAVEN_CENTRAL_USERNAME # env variable for username in deploy
server-password: MAVEN_CENTRAL_TOKEN # env variable for token in deploy
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Value of the GPG private key to import
gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase
- name: Set the revision property
run: mvn versions:set-property -Dproperty=revision "-DnewVersion=${{ github.event.inputs.releaseversion }}" -DgenerateBackupPoms=false
- name: Build with Maven
run: mvn -B deploy --file pom.xml -Pdeploy
env:
MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
- name: Create release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
tag: "${{ github.event.inputs.releaseversion }}"
run: |
gh release create "$tag" \
--repo="$GITHUB_REPOSITORY" \
--title="v${tag#v}" \
--generate-notes \
--target "$GITHUB_SHA"