-
Notifications
You must be signed in to change notification settings - Fork 7
121 lines (108 loc) · 4.09 KB
/
Windows.yml
File metadata and controls
121 lines (108 loc) · 4.09 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
name: Windows
on:
push:
paths-ignore: # 或 paths
- 'README.md'
pull_request:
paths:
- 'README.md'
# - 'CMakeLists.txt'
# - 'src/**'
# - '.github/workflows/Windows.yml'
jobs:
build:
name: Build
# 运行平台, windows-latest目前是windows server 202
# 参考文档 https://github.com/actions/virtual-environments/blob/main/images/win/Windows2019-Readme.md
runs-on: windows-2025
strategy:
# 矩阵配置 5.15.2 参考 https://mirrors.cloud.tencent.com/qt/online/qtsdkrepository/windows_x86/desktop/qt5_5152
matrix:
qt_target: [desktop]
include:
# - qt_ver: 5.15.2
# qt_arch: win32_msvc2019
# msvc_arch: x86
# qt_arch_install: msvc2019
- qt_ver: 5.15.2
qt_arch: win64_msvc2019_64
msvc_arch: x64
qt_arch_install: msvc2019_64
env:
targetName: Microsoft-Defender-Close
targetOS: windows
# 步骤
steps:
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
version: ${{ matrix.qt_ver }}
arch: ${{ matrix.qt_arch }}
set-env: true
- uses: actions/checkout@v4
with:
fetch-depth: 1
submodules: true
- name: Inspect Qt
shell: pwsh
run: |
Get-ChildItem -Recurse -Path $Env:Qt5_Dir
- name: msvc-build
id: msvc-build
shell: cmd
run: |
mkdir bin
mkdir build
cd build
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{ matrix.msvc_arch }}
if "${{ matrix.msvc_arch }}" == "x86" (
echo "-------------- x86 --------------"
cmake -G "Visual Studio 17 2022" -A Win32 ..
devenv "${{ env.targetName }}.sln" /Build "Release|Win32"
) else (
echo "-------------- x64 --------------"
cmake -G "Visual Studio 17 2022" -A x64 ..
devenv "${{ env.targetName }}.sln" /Build "Release|x64"
)
- name: name version
id: name-version
if: startsWith(github.event.ref, 'refs/tags/')
shell: pwsh
run: |
$systemInfo="${{ matrix.msvc_arch }}"
$productVersion="${{ github.ref }}".substring("refs/tags/v".length)
$productName="${{ env.targetName }}-$productVersion-beta-$systemInfo"
echo "systemInfo=$systemInfo" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "productVersion=$productVersion" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "productName=$productName" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
# # tag打为.zip包
# - name: package
# id: package
# if: startsWith(github.event.ref, 'refs/tags/')
# shell: pwsh
# run: |
# Copy-Item -Path build/bin/Release/* -Destination bin/
# dir bin
# echo "-------------- debug 1 --------------"
# # ${{ env.GITHUB_PATH }}/windeployqt bin/${{ env.targetName }}.exe # cache 时使用
# windeployqt bin/${{ env.targetName }}.exe
# echo "-------------- debug 2 --------------"
# Compress-Archive -Path ${{ github.workspace }}/bin/* -Destination ${{ env.productName }}.zip
# dir ${{ github.workspace }}/bin
# - uses: actions/upload-artifact@v3
# with:
# name: my-artifact
# path: ${{ env.productName }}.zip
# # tag上传Release
# - name: uploadRelease
# if: startsWith(github.event.ref, 'refs/tags/')
# uses: softprops/action-gh-release@v1
# env:
# GITHUB_TOKEN: ${{ secrets.upload_release }}
# with:
# draft: false
# prerelease: false
# files: |
# ${{ env.productName }}.zip
# tag: ${{ github.ref }}
# overwrite: true