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:
|
on:
|
||||||
workflow_dispatch: # 手动发布
|
workflow_run:
|
||||||
workflow_run: # 当 build 流程成功完成后自动触发
|
workflows: ["Build"] # 监听名为“Build”的工作流
|
||||||
workflows: ["Build Artifacts"]
|
types:
|
||||||
types: [completed]
|
- completed # 当Build工作流完成时触发
|
||||||
|
branches:
|
||||||
|
- master # 限定分支
|
||||||
jobs:
|
jobs:
|
||||||
release:
|
release:
|
||||||
if: ${{ github.event.workflow_run.conclusion == 'success' }}
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
|
||||||
- name: Download Artifact
|
|
||||||
uses: actions/download-artifact@v3
|
|
||||||
with:
|
|
||||||
name: binaries
|
|
||||||
|
|
||||||
- name: Create Release
|
# 仅在Build工作流成功时运行
|
||||||
uses: softprops/action-gh-release@v1
|
if: github.event.workflow_run.conclusion == 'success'
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.TOKEN }}
|
steps:
|
||||||
with:
|
- name: Release
|
||||||
tag_name: v$(date +%s)
|
uses: softprops/action-gh-release@v2
|
||||||
files: |
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
*.tar.gz
|
|
||||||
Loading…
Reference in New Issue