Skip to content

Commit 377014b

Browse files
committed
ci: 重构发布工作流以使用外部可重用工作流
将原有的复杂发布工作流替换为引用外部仓库的可重用工作流,简化配置并统一权限管理
1 parent f965948 commit 377014b

File tree

1 file changed

+11
-45
lines changed

1 file changed

+11
-45
lines changed

.github/workflows/publish-release.yml

Lines changed: 11 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -4,50 +4,16 @@ on:
44
push:
55
tags:
66
- '*'
7-
# branches: [main]
8-
#schedule:
9-
# 定时任务,每天 UTC 时间 0 点运行
10-
#- cron: "0 0 * * *"
11-
12-
#workflow_dispatch:
13-
permissions: # Global permissions configuration starts here
14-
contents: read # 'read' access to repository contents
15-
pull-requests: write # 'write' access to pull requests
167

178
jobs:
18-
tags:
19-
runs-on: ubuntu-latest
20-
21-
permissions:
22-
contents: write
23-
steps:
24-
- name: Checkout code
25-
uses: actions/checkout@v4
26-
with:
27-
fetch-depth: 0 # 为了 git pull --unshallow,我们需要获取所有的提交历史
28-
29-
- name: Set up Git user
30-
run: |
31-
git config --global user.email "[email protected]"
32-
git config --global user.name "AlianBlank"
33-
34-
- name: "✏️ Generate release changelog"
35-
uses: heinrichreimer/[email protected]
36-
with:
37-
token: ${{ secrets.GITHUB_TOKEN }}
38-
39-
- name: Commit CHANGELOG.md
40-
run: |
41-
git add CHANGELOG.md
42-
git commit -m "[修改]1.修改更新日志"
43-
44-
- name: change-version-by-tag
45-
uses: AlianBlank/[email protected]
46-
with:
47-
version: ${{ github.ref_name }}
48-
49-
- name: Push changes
50-
uses: ad-m/github-push-action@master
51-
with:
52-
force: true
53-
tags: true
9+
publish-release:
10+
# 引用外部仓库的可重用工作流
11+
# 权限由外部工作流统一配置,无需在调用方声明
12+
uses: GameFrameX/public-github-actions/.github/workflows/publish-release.yml@main
13+
with:
14+
# 传递tag名称给外部工作流
15+
tag_name: ${{ github.ref_name }}
16+
# 传递仓库名称
17+
repository_name: ${{ github.repository }}
18+
# 组织级别已配置密钥,可以使用 inherit 继承所有密钥
19+
secrets: inherit

0 commit comments

Comments
 (0)