-
Notifications
You must be signed in to change notification settings - Fork 28
62 lines (55 loc) · 2.05 KB
/
Copy pathtag.yml
File metadata and controls
62 lines (55 loc) · 2.05 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
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')
steps:
- name: Checkout project
uses: actions/checkout@v7
with:
token: ${{ secrets.CI_CD_TOKEN }}
- name: Set up JDK 17
uses: actions/setup-java@v5
with:
java-version: '17'
distribution: 'temurin'
cache: maven
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@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
run: |
if [[ ! "${{ github.event.inputs.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: ${{ github.event.inputs.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
run: |
mvn versions:set -DnewVersion=${{ github.event.inputs.release_version }}
git add pom.xml
git add **/pom.xml
git commit -s -m "Prepare release v${{ github.event.inputs.release_version }}"
git push
git tag v${{ github.event.inputs.release_version }} -s -m "Create tag v${{ github.event.inputs.release_version }}"
git push origin v${{ github.event.inputs.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