-
Notifications
You must be signed in to change notification settings - Fork 1
73 lines (65 loc) · 3.04 KB
/
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
name: Tag & Release
on:
workflow_dispatch:
inputs:
releaseVersion:
description: "Version number to be released (use semver semantic: 'X.Y.Z')"
required: true
developmentVersion:
description: "Next development version to be set (use semver semantic: 'X.Y.Z', `-SNAPSHOT` suffix will be automatically added)"
required: true
permissions:
contents: write
deployments: write
pull-requests: write
jobs:
Releasing:
runs-on: ubuntu-latest
steps:
- name: Checkout Source Code
uses: actions/checkout@v4
- name: Set up Maven Central Repository
uses: actions/setup-java@v3
with:
java-version: '21'
distribution: 'temurin'
server-id: ossrh
server-username: OSSRH_USER
server-password: OSSRH_PWD
gpg-private-key: ${{ secrets.GPG_KEY }}
gpg-passphrase: GPG_PWD
- name: Cache local Maven repository
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Configure git
run: |
git config user.name git
git config user.email [email protected]
git config --global credential.helper cache
git config --global credential.https://github.com.username ${{ env.GITHUB_USERNAME }}
git config --global credential.https://github.com.password ${{ env.GITHUB_TOKEN }}
env:
GITHUB_USERNAME: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create and switch to dedicated release branch
run: |
git checkout -b release-${{ github.event.inputs.releaseVersion }}
- name: Release
run: |
mvn --batch-mode -s settings.xml release:clean release:prepare -Dtag=v${{ github.event.inputs.releaseVersion }} -DreleaseVersion=${{ github.event.inputs.releaseVersion }} -DdevelopmentVersion=${{ github.event.inputs.developmentVersion }}-SNAPSHOT -DscmReleaseCommitComment="[release] Set release & tag: ${{ github.event.inputs.releaseVersion }}" -DscmDevelopmentCommitComment="[release] Set next version: ${{ github.event.inputs.developmentVersion }}-SNAPSHOT"
mvn --batch-mode -s settings.xml release:perform -Dusername=${{ env.GITHUB_USERNAME }} -Dpassword=${{ env.GITHUB_TOKEN }} -DskipTests=true
env:
OSSRH_USER: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PWD: ${{ secrets.OSSRH_PWD }}
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}
GPG_PWD: ${{ secrets.GPG_PWD }}
GITHUB_USERNAME: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create dedicated release pull request
run: gh pr create -d -B main -H release-${{ github.event.inputs.releaseVersion }} --title "Merge release release-${{ github.event.inputs.releaseVersion }} branch into main" --body 'Created by Github action'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}