Repository navigation
63 lines (51 loc) · 1.74 KB
/
Copy pathrelease.yml
File metadata and controls
63 lines (51 loc) · 1.74 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
name: Manual Build and Release (Spring Boot JDK17)
on:
workflow_dispatch:
inputs:
version: # 输入参数名
description: 'Release version (e.g. v25.10.25)' # 提示
required: false
default: '' # 默认空,表示自动生成
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
# 1️⃣ 检出源码
- name: Checkout source
uses: actions/checkout@v4
# 2️⃣ 设置 JDK 17
- name: Setup JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
# 3️⃣ 构建
- name: Build with Maven
run: mvn clean package -DskipTests
# 4️⃣ 设置版本号:优先使用手动输入,否则自动生成
- name: Set version tag
id: version
run: |
if [ -n "${{ github.event.inputs.version }}" ]; then
echo "version=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
else
echo "version=v$(date +'%y.%m.%d')" >> $GITHUB_OUTPUT
fi
# 5️⃣ 创建 Release 并上传 jar
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.version.outputs.version }}
name: "${{ steps.version.outputs.version }}"
body: |
🎉 自动构建发布(Spring Boot 3 + JDK 17)
🏷 构建版本:${{ steps.version.outputs.version }}
💻 构建环境:
- Spring Boot 3
- JDK 17 (Temurin)
⚙️ 构建方式:mvn clean package -DskipTests
files: target/*.jar
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}