-
Notifications
You must be signed in to change notification settings - Fork 100
189 lines (167 loc) · 6.76 KB
/
release-windows-vcpkg-cmake.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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
name: Release Windows CMake
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
workflow_dispatch:
push:
branches:
- dev
- master
- experimental
paths-ignore:
- 'docs/**'
- "*.md"
- ".*"
jobs:
build:
name: Build
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-2022]
qt_ver: [ 6.7.3, 6.6.3 ]
qt_arch: [win64_msvc2019_64]
env:
version: 24.11.0
versionSuffix: ${{ !contains(github.ref_name,'master') && 'alpha' || 'Release' }}
prerelease: ${{ !contains(github.ref_name,'master') }}
steps:
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
version: ${{ matrix.qt_ver }}
# target: ${{ matrix.qt_target }}
arch: ${{ matrix.qt_arch }}
modules: qtwebengine qtwebchannel qtpositioning qt5compat qtmultimedia qtimageformats qtspeech
setup-python: 'false'
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
- name: Setup changelog
id: changelog
shell: bash
env:
prerelease: ${{env.prerelease}}
run: |
if [[ "$prerelease" == 'true' ]]
then
echo "This is a pre-release"
previousTag=$(git tag --sort=-creatordate | grep "^v" | sed -n 2p)
currentTag=$(git tag --sort=-creatordate | grep "^v" | sed -n 1p)
else
echo "This is not a pre-release"
previousTag=$(git tag --sort=-creatordate | grep "^v" | grep -v "alpha" | sed -n 2p)
currentTag=$(git tag --sort=-creatordate | grep "^v" | grep -v "alpha" | sed -n 1p)
fi
echo "prev_tag=$previousTag" >> $GITHUB_OUTPUT
echo "curr_tag=$currentTag" >> $GITHUB_OUTPUT
echo "previousTag : $previousTag"
echo "currentTag : $currentTag"
- name: "Build Changelog"
id: build_changelog
uses: mikepenz/release-changelog-builder-action@v3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
commitMode: false
fromTag: "${{ steps.changelog.outputs.prev_tag }}"
toTag: "${{ steps.changelog.outputs.curr_tag }}"
configurationJson: |
{
"template": "#{{CHANGELOG}}\n\n<details>\n<summary>🔴 Uncategorized</summary>\n\n#{{UNCATEGORIZED}}\n</details>",
"categories": [
{
"title": "## 🚀 Features",
"labels": ["feature","feat","opt"]
},
{
"title": "## 🐛 Fixes",
"labels": ["fix","bug"]
}
,
{
"title": "## 🤖 Github action",
"labels": ["action"]
}
,
{
"title": "## 🧼 Clean Code",
"labels": ["clean"]
}
],
"label_extractor": [
{
"pattern": "([^:]*):.*",
"target": "$1",
"on_property": "title",
"flags": "gu"
}
]
}
- name: Build binaries
id: build
run: |
# Launch-VsDevShell also provides Ninja
& 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\Launch-VsDevShell.ps1' `
-SkipAutomaticLocation -Arch amd64 -HostArch amd64
New-Item -Path './build_dir' -ItemType Directory
# RelWithDebInfo + msvc's = .pdb file beside program file.
cmake -S . -B "./build_dir" `
-G Ninja `
-DCMAKE_C_COMPILER="cl.exe" -DCMAKE_CXX_COMPILER="cl.exe" `
-DCMAKE_BUILD_TYPE=RelWithDebInfo `
-DWITH_FFMPEG_PLAYER=OFF `
-DWITH_VCPKG_BREAKPAD=ON
cmake --build "./build_dir"
- name: CPack create package
run: |
cd './build_dir'
cpack --verbose --trace
cd ..
pwd
- name: Upload packages
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
$tagName = "v$env:version-$env:versionSuffix.$(git rev-parse --short=8 HEAD)"
$releaseName = "v$env:version-$env:versionSuffix.$(date +'%y%m%d').$(git rev-parse --short=8 HEAD)"
Add-Content -Path ./change_note.txt -Value "
[Install instructions for Windows, macOS and Linux](https://xiaoyifang.github.io/goldendict-ng/install/).
Filename pattern: GoldenDict-ng-[version]-[Qt version]-[system name]-...
For Linux, the released version is on Flathub → [io.github.xiaoyifang.goldendict_ng](https://flathub.org/apps/io.github.xiaoyifang.goldendict_ng).
Based on branch: ${{github.ref_name}}
#### Changes
"
Add-Content -Path ./change_note.txt -Value @'
${{steps.build_changelog.outputs.changelog}}
'@
$tagExist = gh api --silent "repos/:owner/:repo/git/refs/tags/${tagName}"
if (-not $?) {
if ($env:prerelease -eq "true") {
gh release create ${tagName} -t ${releaseName} --target ${{github.ref_name}} --notes-file=./change_note.txt --latest=false --prerelease
} else {
gh release create ${tagName} -t ${releaseName} --target ${{github.ref_name}} --notes-file=./change_note.txt --latest=true
}
}
# file name after # is display label
$namePrefix="GoldenDict-ng-${{env.version}}-Qt${{matrix.qt_ver}}"
cd './build_dir'
gh release upload "${tagName}" "${namePrefix}.7z#${namePrefix}-Windows.7z" --clobber
gh release upload "${tagName}" "${namePrefix}.exe#${namePrefix}-Windows-installer.exe" --clobber
- name: Upload Single packages
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
tagName="v${{env.version}}-${{env.versionSuffix}}.$(git rev-parse --short=8 HEAD)"
echo $tagName
namePrefix="GoldenDict-ng-${{env.version}}-Qt${{matrix.qt_ver}}"
cd ./build_dir/goldendict
# rename to avoid conflict with other packages
mv goldendict.exe goldendict-Qt${{matrix.qt_ver}}.exe
mv goldendict.pdb goldendict-Qt${{matrix.qt_ver}}.pdb
gh release upload "${tagName}" "goldendict-Qt${{matrix.qt_ver}}.exe#${namePrefix}-Windows-main-exe-file-only.exe" --clobber
gh release upload "${tagName}" "goldendict-Qt${{matrix.qt_ver}}.pdb#${namePrefix}-Windows-debug-file.pdb" --clobber
cd ..