Skip to content

Commit be49bf5

Browse files
author
zhangfuwen
committed
ci(workflow): 添加标签触发和发布步骤
在CMake单平台工作流中添加标签触发条件,并引入发布步骤以在打标签时自动创建发布。发布步骤包括下载构建产物并生成发布说明。
1 parent 22921b7 commit be49bf5

File tree

1 file changed

+26
-18
lines changed

1 file changed

+26
-18
lines changed

.github/workflows/cmake-single-platform.yml

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ name: CMake on a single platform
55
on:
66
push:
77
branches: [ "master" ]
8+
tags:
9+
- 'v*'
810
pull_request:
911
branches: [ "master" ]
1012

@@ -42,28 +44,34 @@ jobs:
4244
uses: actions/[email protected]
4345
with:
4446
name: build-artifacts
45-
path:
46-
- ${{github.workspace}}/build/kernel.iso
47-
- ${{github.workspace}}/build/test.img
47+
path: |
48+
${{github.workspace}}/build/kernel.iso
49+
${{github.workspace}}/build/test.img
4850
if-no-files-found: error
4951
compression-level: 6
5052
overwrite: true
5153
include-hidden-files: false
5254

53-
# - name: Release
54-
# uses: googleapis/[email protected]
55-
# with:
56-
# # GitHub token for creating and grooming release PRs, defaults to using secrets.GITHUB_TOKEN
57-
# token: ${{ github.token }}
58-
# # what type of release is this, one of (ruby, python, node, terraform-module)
59-
# release-type: simple
60-
# # Should stale release PRs be closed post release? Defaults to true
61-
# clean: true
62-
55+
release:
56+
needs: build
57+
if: startsWith(github.ref, 'refs/tags/')
58+
runs-on: ubuntu-latest
59+
permissions:
60+
contents: write
61+
steps:
62+
- name: Download Build Artifacts
63+
uses: actions/download-artifact@v4
64+
with:
65+
name: build-artifacts
66+
path: artifacts
6367

64-
# - name: Test
65-
# working-directory: ${{github.workspace}}/build
66-
# # Execute tests defined by the CMake configuration.
67-
# # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
68-
# run: ctest -C ${{env.BUILD_TYPE}}
68+
- name: Create Release
69+
uses: softprops/action-gh-release@v1
70+
with:
71+
files: |
72+
artifacts/kernel.iso
73+
artifacts/test.img
74+
draft: false
75+
prerelease: false
76+
generate_release_notes: true
6977

0 commit comments

Comments
 (0)