-
Notifications
You must be signed in to change notification settings - Fork 0
90 lines (75 loc) · 2.39 KB
/
Copy pathrelease.yml
File metadata and controls
90 lines (75 loc) · 2.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
name: Release
on:
push:
tags: ["v*"]
workflow_dispatch:
permissions:
contents: write
jobs:
meta:
name: 版本信息
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: 解析版本
id: set_tag
run: |
tag="${{ github.ref_name }}"
is_release=${{ startsWith(github.ref, 'refs/tags/v') }}
if ! $is_release; then
tag="$(date +v0.0.0-%y%m%d-$(git rev-parse --short HEAD))"
fi
is_prerelease=false
if [[ $tag =~ .*alpha.* || $tag =~ .*beta.* || $tag =~ .*rc.* ]]; then
is_prerelease=true
fi
echo "tag=$tag" | tee -a $GITHUB_OUTPUT
echo "is_release=$is_release" | tee -a $GITHUB_OUTPUT
echo "is_prerelease=$is_prerelease" | tee -a $GITHUB_OUTPUT
outputs:
tag: ${{ steps.set_tag.outputs.tag }}
is_release: ${{ steps.set_tag.outputs.is_release }}
is_prerelease: ${{ steps.set_tag.outputs.is_prerelease }}
build:
name: 构建 (${{ matrix.arch }})
needs: meta
strategy:
matrix:
arch: [x64]
fail-fast: false
runs-on: windows-2022
steps:
- uses: actions/checkout@v4
- name: 配置 CMake
run: cmake -B build -G "Visual Studio 17 2022" -A ${{ matrix.arch }}
- name: 编译
run: cmake --build build --config Release
- name: 打包
shell: pwsh
run: |
Compress-Archive -Path build/Release/OpenSysKit.sys -DestinationPath "OpenSysKit-Driver-${{ matrix.arch }}-${{ needs.meta.outputs.tag }}.zip"
- uses: actions/upload-artifact@v4
with:
name: OpenSysKit-Driver-${{ matrix.arch }}
path: "OpenSysKit-Driver-${{ matrix.arch }}-${{ needs.meta.outputs.tag }}.zip"
release:
name: 发布
if: ${{ needs.meta.outputs.is_release == 'true' }}
needs: [meta, build]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
pattern: OpenSysKit-Driver-*
path: artifacts
merge-multiple: true
- name: 发布 Release
uses: softprops/action-gh-release@v2
with:
files: artifacts/*.zip
tag_name: ${{ needs.meta.outputs.tag }}
generate_release_notes: true
draft: false
prerelease: ${{ needs.meta.outputs.is_prerelease == 'true' }}