-
Notifications
You must be signed in to change notification settings - Fork 0
68 lines (57 loc) · 1.79 KB
/
release.yml
File metadata and controls
68 lines (57 loc) · 1.79 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
name: Release
on:
workflow_dispatch:
inputs:
version:
description: 'Release version (X.Y format)'
required: true
type: string
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
cache: 'maven'
- name: Configure Git
run: |
git config user.name "GitHub Actions"
git config user.email "actions@github.com"
- name: Validate version format
run: |
if ! [[ "${{ github.event.inputs.version }}" =~ ^[0-9]+\.[0-9]+$ ]]; then
echo "Error: Version must be in X.Y format (e.g., 1.0, 1.1, 2.0)"
exit 1
fi
- name: Update version in pom.xml
run: |
mvn versions:set -DnewVersion=${{ github.event.inputs.version }}
mvn versions:commit
- name: Build and test
run: mvn clean verify
- name: Commit version change
run: |
git add pom.xml
git commit -m "Release version ${{ github.event.inputs.version }}"
git push
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ github.event.inputs.version }}
name: Release ${{ github.event.inputs.version }}
body: |
Release version ${{ github.event.inputs.version }}
See [CHANGELOG.md](https://github.com/${{ github.repository }}/blob/main/CHANGELOG.md) for details.
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}