-
Notifications
You must be signed in to change notification settings - Fork 4
145 lines (123 loc) · 4.84 KB
/
build-artifacts.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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
name: Build artifacts
on:
push:
branches: [ master ]
tags:
- 'v*'
pull_request:
branches: [ master ]
jobs:
build:
name: Build
runs-on: windows-latest
steps:
- name: Install Qt environment
uses: jurplel/install-qt-action@v3
with:
version: '6.7.0'
host: 'windows'
target: 'desktop'
arch: 'win64_msvc2019_64'
install-deps: 'true'
cache: 'true'
tools: 'tools_opensslv3_x64 tools_ifw'
modules: 'qtlocation qtpositioning'
- name: Checkout codes
uses: actions/checkout@v4
- name: Build exectuable
shell: cmd
run: |
for /f "delims=" %%d in ( 'vswhere.exe -latest -property installationPath' ) do @( call "%%d\VC\Auxiliary\Build\vcvars64.bat" )
qmake "CONFIG+=qtquickcompiler" CONFIG+=release
nmake
- name: Set short SHA as package name
if: "!startsWith(github.event.ref, 'refs/tags/')"
run: echo "ARCHIVE_NAME=NyaTrace-$(git rev-parse --short HEAD)-MSVC-64bit" >> $env:GITHUB_ENV
- name: Set tag version into env
if: startsWith(github.event.ref, 'refs/tags/')
run: echo "TAG_NAME=${env:GITHUB_REF_NAME}" >> $env:GITHUB_ENV
- name: Set tag version as package name
if: startsWith(github.event.ref, 'refs/tags/')
run: echo "ARCHIVE_NAME=NyaTrace-${env:TAG_NAME}-MSVC-64bit" >> $env:GITHUB_ENV
- name: Prepare workspace
shell: pwsh
run: |
# Prepare workspace dir
New-Item -ItemType Directory workspace
# Prepare target dir
New-Item -ItemType Directory workspace\${env:ARCHIVE_NAME}
# Copy executable
Copy-Item release\NyaTrace.exe workspace\${env:ARCHIVE_NAME}\
- name: Win Deploy Qt
shell: cmd
run: |
call "%Qt6_DIR%\bin\qtenv2.bat"
for /f "delims=" %%d in ( 'vswhere.exe -latest -property installationPath' ) do @( call "%%d\VC\Auxiliary\Build\vcvars64.bat" )
chdir /d %GITHUB_WORKSPACE%\workspace\%ARCHIVE_NAME%
windeployqt --qmldir %GITHUB_WORKSPACE% --release NyaTrace.exe
- name: Move VC Redist installer out (no need to pack into installer)
shell: pwsh
run: |
Move-Item workspace\${env:ARCHIVE_NAME}\vc_redist.x64.exe workspace\
- name: Upload vc_redist
uses: actions/upload-artifact@v4
with:
name: vc_redist.x64.exe
path: workspace\vc_redist.x64.exe
- name: Prepare theme files
shell: pwsh
run: |
Copy-Item -Recurse theme workspace\${env:ARCHIVE_NAME}\
- name: Prepare icon file
shell: pwsh
run: |
Copy-Item -Recurse icon.ico workspace\${env:ARCHIVE_NAME}\
- name: Prepare MMDB notices
shell: pwsh
run: |
New-Item -ItemType Directory workspace\${env:ARCHIVE_NAME}\mmdb
$mmdbNotice = '请将 MMDB 文件放置在这里,具体操作请参见 https://github.com/Candinya/NyaTrace 相关的说明。'
$mmdbNotice | Out-File workspace\${env:ARCHIVE_NAME}\mmdb\'请将 MMDB 文件放置在这里.txt'
- name: Prepare OpenSSL DLLs
shell: pwsh
run: |
Copy-Item ${env:IQTA_TOOLS}'\OpenSSLv3\Win_x64\bin\lib*-x64.dll' workspace\${env:ARCHIVE_NAME}\
- name: Package artifacts
shell: pwsh
run: |
Compress-Archive -Path workspace\${env:ARCHIVE_NAME}, LICENSE, workspace\vc_redist.x64.exe -DestinationPath ${env:ARCHIVE_NAME}'.zip'
- name: Upload built zip
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARCHIVE_NAME }}.zip
path: ${{ env.ARCHIVE_NAME }}.zip
- name: Create installer
shell: pwsh
run: |
New-Item -ItemType Directory installer\packages\net.candymade.nyatrace\data
Copy-Item -Recurse workspace\${env:ARCHIVE_NAME}\* installer\packages\net.candymade.nyatrace\data\
& "${env:IQTA_TOOLS}\QtInstallerFramework\4.7\bin\binarycreator.exe" -c installer\config\config.xml -p installer\packages ${{ env.ARCHIVE_NAME }}-Installer.exe -v
- name: Upload built installer
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARCHIVE_NAME }}-Installer.exe
path: ${{ env.ARCHIVE_NAME }}-Installer.exe
- name: Move VC Redist installer out (let release action find it)
if: startsWith(github.event.ref, 'refs/tags/')
shell: pwsh
run: |
Move-Item workspace\vc_redist.x64.exe .\
- name: Create release (draft)
if: startsWith(github.event.ref, 'refs/tags/')
uses: softprops/action-gh-release@v2
with:
name: NyaTrace - ${{ env.TAG_NAME }}
tag_name: ${{ env.TAG_NAME }}
generate_release_notes: true
draft: true
files: |
${{ env.ARCHIVE_NAME }}.zip
${{ env.ARCHIVE_NAME }}-Installer.exe
vc_redist.x64.exe
env:
GITHUB_TOKEN: ${{ secrets.CI_TOKEN }}