-
Notifications
You must be signed in to change notification settings - Fork 28
69 lines (62 loc) · 2.31 KB
/
Copy pathtag.yml
File metadata and controls
69 lines (62 loc) · 2.31 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
name: Tag
on:
workflow_dispatch:
inputs:
release_version:
description: 'Release version'
required: true
jobs:
tag:
name: Tag
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/hotfix/v')
permissions:
contents: read
steps:
- name: Checkout project
# zizmor: ignore[artipacked] persisted credentials are required to push the release commit and tag below
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
with:
token: ${{ secrets.CI_CD_TOKEN }}
- name: Set up JDK 17
uses: actions/setup-java@1bcf9fb12cf4aa7d266a90ae39939e61372fe520 # v5
with:
java-version: '17'
distribution: 'temurin'
cache: maven
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@2dc316deee8e90f13e1a351ab510b4d5bc0c82cd # v7
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
git_user_signingkey: true
git_commit_gpgsign: true
- name: Validate release version format
env:
RELEASE_VERSION: ${{ github.event.inputs.release_version }}
run: |
if [[ ! "$RELEASE_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Release version must follow SemVer format (X.Y.Z) and start with a digit"
echo "Current value: $RELEASE_VERSION"
echo "Expected format: 1.2.3, 2.0.0, etc."
echo "Note: The 'v' prefix will be added automatically to the tag. Do not include it manually"
exit 1
fi
- name: Create tag
env:
RELEASE_VERSION: ${{ github.event.inputs.release_version }}
run: |
mvn versions:set -DnewVersion="$RELEASE_VERSION"
git add pom.xml
git add **/pom.xml
git commit -s -m "Prepare release v$RELEASE_VERSION"
git push
git tag "v$RELEASE_VERSION" -s -m "Create tag v$RELEASE_VERSION"
git push origin "v$RELEASE_VERSION"
- name: Update next version
run: |
mvn versions:set -DnextSnapshot=true
git add pom.xml
git add **/pom.xml
git commit -s -m "Prepare next snapshot version [skip ci]"
git push