-
Notifications
You must be signed in to change notification settings - Fork 16
126 lines (125 loc) · 3.99 KB
/
windows.yml
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
122
123
124
125
126
name: Windows
on:
# push代码时触发workflow
push:
paths:
- '**'
pull_request:
paths:
- '**'
jobs:
build:
name: Build
# 参考文档 https://github.com/actions/virtual-environments/blob/main/images/win/Windows2019-Readme.md
runs-on: windows-latest
strategy:
# 矩阵配置
matrix:
include:
# 5.12.12
- qt_version: 5.12.12
qt_arch: win64_msvc2015_64
arch: x64
- qt_version: 5.12.12
qt_arch: win64_msvc2017_64
arch: x64
# 5.15.2
- qt_version: 5.15.2
qt_arch: win32_msvc2019
arch: win32
- qt_version: 5.15.2
qt_arch: win64_msvc2019_64
arch: x64
# 6.2.4
- qt_version: 6.2.4
qt_arch: win64_msvc2019_64
arch: x64
# 6.7.2
- qt_version: 6.7.2
qt_arch: win64_msvc2019_64
arch: x64
modules: 'qthttpserver qtwebsockets'
env:
BUILD_TYPE: Release
BUILD_PATH: build
assume: --release
qt_target: 'desktop'
qt_host: 'windows'
# 压缩包名称
archiveName: 'QCloudMusicApi-${{ matrix.qt_version }}-${{ matrix.qt_arch }}.zip'
# 步骤
steps:
# 安装Qt
- name: Install Qt
if: 'true'
# 使用外部action。这个action专门用来安装Qt
uses: jurplel/install-qt-action@v4
with:
version: ${{ matrix.qt_version }}
host: ${{ env.qt_host }}
target: ${{ env.qt_target }}
arch: ${{ matrix.qt_arch }}
install-deps: 'true'
cache: 'true'
aqtversion: '==3.1.*'
modules: ${{ matrix.modules }}
# tools: ${{ matrix.tools }}
# 拉取代码
- uses: actions/checkout@v4
with:
fetch-depth: 1
submodules: recursive
- name: CMake Build
id: build
shell: cmd
run: |
cmake -A ${{ matrix.arch }} -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DCMAKE_INSTALL_PREFIX=${{ env.BUILD_PATH }}/${{ env.BUILD_TYPE }} -B ${{ env.BUILD_PATH }}
ls
# CMake Install
- name: CMake Install
env:
prefix: ${{ github.workspace }}
shell: pwsh
run: |
cd ${{ github.workspace }}
cmake --build ${{ env.BUILD_PATH }} --target install --config ${{ env.BUILD_TYPE }} -j
ls
# 拷贝依赖
- name: Copy Dependency
id: copyDependency
shell: pwsh
env:
path: ${{ github.workspace }}/${{ env.BUILD_PATH }}/${{ env.BUILD_TYPE }}
continue-on-error: true
run: |
# tree /F
# 拷贝依赖
windeployqt ${{ env.assume }} --qmldir . --no-translations --compiler-runtime ${{ env.path }}/bin/QCloudMusicApi.dll
windeployqt ${{ env.assume }} --qmldir . --no-translations --compiler-runtime ${{ env.path }}/bin/Test.exe
windeployqt ${{ env.assume }} --qmldir . --no-translations --compiler-runtime ${{ env.path }}/bin/ApiServer.exe
# tag 查询github-Release
# 上传artifacts
- uses: actions/upload-artifact@v4
with:
name: ${{ env.archiveName }}
path: ${{ github.workspace }}/${{ env.BUILD_PATH }}/${{ env.BUILD_TYPE }}
# 打包
- name: Package
if: startsWith(github.event.ref, 'refs/tags/')
id: package
shell: pwsh
env:
path: ${{ github.workspace }}/${{ env.BUILD_PATH }}/${{ env.BUILD_TYPE }}
run: |
# 打包zip
Compress-Archive -Path ${{ env.path }}/* ${{ env.archiveName }}
# tree /F
# tag 上传Release
- name: Upload Release
if: startsWith(github.event.ref, 'refs/tags/')
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ github.workspace }}/${{ env.archiveName }}
tag: ${{ github.ref }}
overwrite: true