Skip to content

Commit 69e2920

Browse files
committed
👷 新增手动发布工作流,支持版本构建和标签管理
1 parent b8e4886 commit 69e2920

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Manual Release
2+
3+
on:
4+
workflow_dispatch:
5+
6+
permissions:
7+
contents: write
8+
9+
jobs:
10+
release:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v4
15+
16+
- name: Set up JDK 21
17+
uses: actions/setup-java@v4
18+
with:
19+
java-version: "21"
20+
distribution: "temurin"
21+
22+
- name: Setup Gradle
23+
uses: gradle/actions/setup-gradle@v4
24+
25+
- name: Get version from gradle.properties
26+
id: project_version
27+
run: echo "version=$(grep '^version=' gradle.properties | cut -d'=' -f2)" >> $GITHUB_OUTPUT
28+
29+
- name: Get current date
30+
id: date
31+
run: echo "date=$(date +'%Y-%m-%d %H:%M:%S UTC')" >> $GITHUB_OUTPUT
32+
33+
- name: Build project
34+
run: ./gradlew clean build
35+
36+
- name: Delete existing tag if exists
37+
run: |
38+
VERSION=${{ steps.project_version.outputs.version }}
39+
git tag -d "v${VERSION}" 2>/dev/null || true
40+
git push origin ":refs/tags/v${VERSION}" 2>/dev/null || true
41+
continue-on-error: true
42+
43+
- name: Create and push tag
44+
run: |
45+
VERSION=${{ steps.project_version.outputs.version }}
46+
git config --local user.email "action@github.com"
47+
git config --local user.name "GitHub Action"
48+
git tag "v${VERSION}"
49+
git push origin "v${VERSION}"
50+
51+
- name: Release
52+
uses: softprops/action-gh-release@v2
53+
with:
54+
tag_name: v${{ steps.project_version.outputs.version }}
55+
name: FGateClient v${{ steps.project_version.outputs.version }}
56+
draft: false
57+
generate_release_notes: true
58+
prerelease: false
59+
body: |
60+
## FGateClient v${{ steps.project_version.outputs.version }}
61+
62+
**发布时间:** ${{ steps.date.outputs.date }}

0 commit comments

Comments
 (0)