ci: 更新 Release 工作流
- 优化工作流触发条件,仅在 Build 工作流完成后触发 - 限定触发分支为 master - 更新 action-gh-release 版本至 v2 - 调整发布逻辑,仅在带有 refs/tags/ 前缀的引用上进行发布
This commit is contained in:
parent
58ffabd619
commit
c137db55f9
|
|
@ -1,24 +1,20 @@
|
|||
name: Create Release
|
||||
name: Release
|
||||
|
||||
on:
|
||||
workflow_dispatch: # 手动发布
|
||||
workflow_run: # 当 build 流程成功完成后自动触发
|
||||
workflows: ["Build Artifacts"]
|
||||
types: [completed]
|
||||
workflow_run:
|
||||
workflows: ["Build"] # 监听名为“Build”的工作流
|
||||
types:
|
||||
- completed # 当Build工作流完成时触发
|
||||
branches:
|
||||
- master # 限定分支
|
||||
jobs:
|
||||
release:
|
||||
if: ${{ github.event.workflow_run.conclusion == 'success' }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Download Artifact
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: binaries
|
||||
|
||||
- name: Create Release
|
||||
uses: softprops/action-gh-release@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.TOKEN }}
|
||||
with:
|
||||
tag_name: v$(date +%s)
|
||||
files: |
|
||||
*.tar.gz
|
||||
# 仅在Build工作流成功时运行
|
||||
if: github.event.workflow_run.conclusion == 'success'
|
||||
|
||||
steps:
|
||||
- name: Release
|
||||
uses: softprops/action-gh-release@v2
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
Loading…
Reference in New Issue