Skip to content

Commit 375debd

Browse files
committed
👷 新增手动发布工作流
1 parent b8e4886 commit 375debd

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
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+
with:
25+
gradle-version: "8.9"
26+
27+
- name: Get version from gradle.properties
28+
id: project_version
29+
run: echo "version=$(grep '^version=' gradle.properties | cut -d'=' -f2)" >> $GITHUB_OUTPUT
30+
31+
- name: Get current date
32+
id: date
33+
run: echo "date=$(date +'%Y-%m-%d %H:%M:%S UTC')" >> $GITHUB_OUTPUT
34+
35+
- name: Package artifacts
36+
run: gradle package
37+
38+
- name: Delete existing tag if exists
39+
run: |
40+
VERSION=${{ steps.project_version.outputs.version }}
41+
git tag -d "v${VERSION}" 2>/dev/null || true
42+
git push origin ":refs/tags/v${VERSION}" 2>/dev/null || true
43+
continue-on-error: true
44+
45+
- name: Create and push tag
46+
run: |
47+
VERSION=${{ steps.project_version.outputs.version }}
48+
git config --local user.email "action@github.com"
49+
git config --local user.name "GitHub Action"
50+
git tag "v${VERSION}"
51+
git push origin "v${VERSION}"
52+
53+
- name: Release
54+
uses: softprops/action-gh-release@v2
55+
with:
56+
tag_name: v${{ steps.project_version.outputs.version }}
57+
name: v${{ steps.project_version.outputs.version }}
58+
draft: false
59+
generate_release_notes: true
60+
prerelease: false
61+
files: outputs/*.jar

0 commit comments

Comments
 (0)