Skip to content

Commit c7fe3ab

Browse files
committed
ci: 添加发布与同步的GitHub Actions工作流
添加两个可重用的GitHub Actions工作流配置: 1. publish-release.yml:在推送至main分支时触发发布流程 2. sync.yml:监听代码推送和发布完成事件,同步到外部镜像仓库 使用组织级别的共享工作流,简化配置并统一密钥管理
1 parent 70afbfb commit c7fe3ab

2 files changed

Lines changed: 47 additions & 0 deletions

File tree

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Publish Release
2+
3+
on:
4+
push:
5+
branches: [main]
6+
workflow_dispatch:
7+
8+
jobs:
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

.github/workflows/sync.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Sync Github To Image (External)
2+
3+
on:
4+
push:
5+
branches:
6+
- '**'
7+
tags-ignore:
8+
- '**'
9+
workflow_run:
10+
workflows: ["Publish Release"] # 监听的工作流名称
11+
types:
12+
- completed # 监听完成事件
13+
#schedule:
14+
# 定时任务,每天 UTC 时间 0 点运行
15+
#- cron: "0 0 * * *"
16+
workflow_dispatch:
17+
18+
jobs:
19+
sync-gitee:
20+
# 引用外部仓库的可重用工作流
21+
# 格式: {owner}/{repo}/.github/workflows/{filename}@{ref}
22+
uses: GameFrameX/public-github-actions/.github/workflows/sync.yml@main
23+
with:
24+
# 传递参数给外部工作流
25+
target_branch: ${{ github.ref_name }}
26+
repository_name: ${{ github.repository }}
27+
# 组织级别已配置密钥,可以使用 inherit 继承所有密钥
28+
secrets: inherit

0 commit comments

Comments
 (0)