Skip to content

Commit c5a6b82

Browse files
committed
feat(workflow): 重命名工作流并重构发布流程
feat(workflow): 添加从标签获取版本的步骤 feat(workflow): 将构建步骤拆分为构建API和构建发布 feat(workflow): 更新发布操作以包含版本名称和详细说明 refactor(workflow): 改进触发标签的格式并调整缩进 refactor(workflow): 重命名作业从`build`到`release` refactor(workflow): 移除冗余的构建步骤并合并发布任务 docs(workflow): 为标签触发添加注释说明 docs(workflow): 在发布说明中添加下载和依赖信息
1 parent b1a3f5e commit c5a6b82

File tree

2 files changed

+39
-13
lines changed

2 files changed

+39
-13
lines changed

.github/workflows/release.yml

Lines changed: 38 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
name: Releases
1+
name: Release
22

33
on:
44
push:
55
tags:
6-
- 'v*'
6+
- 'v*' # 当推送 v 开头的标签时触发,如 v1.35.91
77

88
jobs:
9-
build:
9+
release:
1010
runs-on: ubuntu-latest
1111
permissions:
1212
contents: write
13-
13+
1414
steps:
1515
- name: Checkout code
1616
uses: actions/checkout@v4
@@ -21,19 +21,45 @@ jobs:
2121
java-version: '8'
2222
distribution: 'zulu'
2323
cache: 'gradle'
24-
24+
2525
- name: Grant execute permission to gradlew
2626
run: chmod +x gradlew
27-
28-
- name: Build project with Gradle
27+
28+
- name: Get version from tag
29+
id: get_version
30+
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
31+
32+
- name: Build API
2933
run: ./gradlew taboolibBuildApi -Pbuild=./build -PpublishUsername=${{ secrets.PUBLISH_USERNAME }} -PpublishPassword=${{ secrets.PUBLISH_PASSWORD }} -Ptoken=${{ secrets.TOKEN }}
30-
31-
- name: Build project with Gradle
32-
run: ./gradlew build -Pbuild=./build -PpublishUsername=${{ secrets.PUBLISH_USERNAME }} -PpublishPassword=${{ secrets.PUBLISH_PASSWORD }} -Ptoken=${{ secrets.TOKEN }}
33-
34+
35+
- name: Build and Publish
36+
run: ./gradlew build publishLibraryPublicationToMavenRepository publishGprPublicationToMavenRepository -Pbuild=./build -PpublishUsername=${{ secrets.PUBLISH_USERNAME }} -PpublishPassword=${{ secrets.PUBLISH_PASSWORD }} -Ptoken=${{ secrets.TOKEN }}
37+
3438
- name: Create Release
35-
uses: ncipollo/release-action@v1.20.0
39+
uses: ncipollo/release-action@v1
3640
with:
41+
name: Orryx v${{ steps.get_version.outputs.VERSION }}
42+
body: |
43+
## Orryx v${{ steps.get_version.outputs.VERSION }}
44+
45+
### 下载
46+
- `Orryx-${{ steps.get_version.outputs.VERSION }}.jar` - 完整插件
47+
- `Orryx-${{ steps.get_version.outputs.VERSION }}-api.jar` - API 依赖
48+
49+
### Maven 依赖
50+
```xml
51+
<dependency>
52+
<groupId>org.gitee.orryx</groupId>
53+
<artifactId>orryx</artifactId>
54+
<version>${{ steps.get_version.outputs.VERSION }}</version>
55+
<classifier>api</classifier>
56+
</dependency>
57+
```
58+
59+
### Gradle 依赖
60+
```kotlin
61+
compileOnly("org.gitee.orryx:orryx:${{ steps.get_version.outputs.VERSION }}:api")
62+
```
3763
allowUpdates: true
3864
artifacts: "build/*.jar"
3965
token: ${{ secrets.TOKEN }}

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
group = org.gitee.orryx
2-
version = 1.35.91
2+
version = 1.35.92
33
org.gradle.jvmargs = -Dfile.encoding=UTF-8
44

55
publishUsername = ''

0 commit comments

Comments
 (0)