-
Notifications
You must be signed in to change notification settings - Fork 7
303 lines (278 loc) · 10.5 KB
/
Copy pathrelease.yml
File metadata and controls
303 lines (278 loc) · 10.5 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
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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
name: release
# Based on https://github.com/ra3xdh/qucs_s/.github/workflows/deploy.yml
# https://github.com/actions/checkout
# https://github.com/actions/upload-artifact
# https://github.com/actions/download-artifact
on:
push:
tags:
- '*'
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
jobs:
build-debian-packages:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
distr:
- name: trixie
version: 13
artifact: "Qt5"
extra_pack: "qtbase5-dev libqt5serialport5-dev qttools5-dev-tools"
flags: ""
- name: trixie
version: 13
artifact: "Qt6"
extra_pack: "qt6-base-dev qt6-base-dev-tools qt6-serialport-dev qt6-5compat-dev qt6-l10n-tools qt6-translations-l10n"
flags: "-q qmake6"
- name: bookworm
version: 12
artifact: "Qt5"
extra_pack: "qtbase5-dev libqt5serialport5-dev qttools5-dev-tools"
flags: ""
- name: bookworm
version: 12
artifact: "Qt6"
extra_pack: "qt6-base-dev qt6-base-dev-tools qt6-serialport-dev qt6-5compat-dev qt6-l10n-tools qt6-translations-l10n"
flags: "-q qmake6"
- name: bullseye
version: 11
artifact: "Qt5"
extra_pack: "qtbase5-dev libqt5serialport5-dev qttools5-dev-tools"
flags: ""
arch:
- name: amd64
id: linux/amd64
container:
# https://en.wikipedia.org/wiki/Debian_version_history
# https://hub.docker.com/_/debian
image: debian:${{matrix.distr.name}}
options: --platform ${{matrix.arch.id}}
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: 'Install Dependencies'
shell: bash
run: |
apt-get update
# https://serverfault.com/a/992421
DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get install -y build-essential ${{matrix.distr.extra_pack}}
- name: 'Build'
shell: bash
run: install/build-deb.sh ${{matrix.distr.flags}} -s debian-${{matrix.distr.name}} -v ${{ github.ref_name }}
- name: 'Upload debian packages'
uses: actions/upload-artifact@v6
with:
name: debian-${{matrix.distr.name}}-${{matrix.distr.artifact}}-${{matrix.arch.name}}
path: '*.deb'
build-ubuntu-packages:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
distr:
- name: resolute
version: 26.04
artifact: "Qt5"
extra_pack: "qtbase5-dev libqt5serialport5-dev qttools5-dev-tools"
flags: ""
- name: resolute
version: 26.04
artifact: "Qt6"
extra_pack: "qt6-base-dev qt6-base-dev-tools qt6-serialport-dev qt6-5compat-dev qt6-l10n-tools qt6-translations-l10n"
flags: "-q qmake6"
- name: noble
version: 24.04
artifact: "Qt5"
extra_pack: "qtbase5-dev libqt5serialport5-dev qttools5-dev-tools"
flags: ""
- name: noble
version: 24.04
artifact: "Qt6"
extra_pack: "qt6-base-dev qt6-base-dev-tools qt6-serialport-dev qt6-5compat-dev qt6-l10n-tools qt6-translations-l10n"
flags: "-q qmake6"
- name: jammy
version: 22.04
artifact: "Qt5"
extra_pack: "qtbase5-dev libqt5serialport5-dev qttools5-dev-tools"
flags: ""
- name: focal
version: 20.04
artifact: "Qt5"
extra_pack: "qtbase5-dev libqt5serialport5-dev qttools5-dev-tools"
flags: ""
arch:
- name: amd64
id: linux/amd64
container:
# https://en.wikipedia.org/wiki/Ubuntu_version_history
# https://hub.docker.com/_/ubuntu
image: ubuntu:${{matrix.distr.name}}
options: --platform ${{matrix.arch.id}}
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: 'Install Dependencies'
shell: bash
run: |
apt-get update
DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get install -y build-essential ${{matrix.distr.extra_pack}}
- name: 'Build'
shell: bash
run: install/build-deb.sh ${{matrix.distr.flags}} -s ubuntu-${{matrix.distr.name}} -v ${{ github.ref_name }}
- name: 'Upload ubuntu packages'
uses: actions/upload-artifact@v6
with:
name: ubuntu-${{matrix.distr.name}}-${{matrix.distr.artifact}}-${{matrix.arch.name}}
path: '*.deb'
# https://en.wikipedia.org/wiki/Fedora_Linux_release_history
# https://hub.docker.com/_/fedora
build-fedora-packages:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
distr:
- version: 43
artifact: "Qt5"
extra_pack: "qt5-qtserialport-devel qt5-linguist"
flags: "-q qmake-qt5"
- version: 43
artifact: "Qt6"
extra_pack: "qt6-qtserialport-devel qt6-qt5compat-devel qt6-linguist"
flags: ""
- version: 42
artifact: "Qt5"
extra_pack: "qt5-qtserialport-devel qt5-linguist"
flags: "-q qmake-qt5"
- version: 42
artifact: "Qt6"
extra_pack: "qt6-qtserialport-devel qt6-qt5compat-devel qt6-linguist"
flags: ""
- version: 41
artifact: "Qt5"
extra_pack: "qt5-qtserialport-devel qt5-linguist"
flags: "-q qmake-qt5"
- version: 41
artifact: "Qt6"
extra_pack: "qt6-qtserialport-devel qt6-qt5compat-devel qt6-linguist"
flags: ""
arch:
- name: amd64
id: linux/amd64
container:
image: fedora:${{matrix.distr.version}}
options: --platform ${{matrix.arch.id}}
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Install Dependencies
run: |
dnf install -q -y coreutils gcc make rpm-build ${{matrix.distr.extra_pack}}
- name: Build
run: install/build-rpm.sh ${{matrix.distr.flags}} -s fedora-${{matrix.distr.version}} -v ${{ github.ref_name }}
- name: Upload fedora packages
uses: actions/upload-artifact@v6
with:
name: fedora-${{matrix.distr.version}}-${{matrix.distr.artifact}}-${{matrix.arch.name}}
path: '*.rpm'
build-windows-installer:
runs-on: windows-2025
strategy:
fail-fast: false
matrix:
msystem: ['mingw64']
defaults:
run:
shell: msys2 {0}
steps:
- name: Disable autocrlf in Git
shell: pwsh
# https://github.com/msys2/setup-msys2?tab=readme-ov-file#actionscheckout-and-line-endings
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- name: Checkout repository
uses: actions/checkout@v5
- name: Set up MSYS2 environment
# The qt5-serialport package is now missing from mingw32, so we use
# a static build. The openssl package is needed for qt-static, but it is
# not in the qt5-static dependencies and so has to be installed explicitly.
uses: msys2/setup-msys2@v2
with:
msystem: ${{matrix.msystem}}
cache: true
update: true
install: >-
make
zip
pacboy: >-
gcc:p
nsis:p
ntldd:p
qt5-static:p
openssl:p
- name: 'Build'
run: install/build-win-msys2.sh -s windows -v ${{ github.ref_name }} -q /${{matrix.msystem}}/qt5-static/bin/qmake.exe
- name: 'Upload windows installers'
uses: actions/upload-artifact@v6
with:
name: windows-${{matrix.msystem}}
path: |
*.exe
*.zip
create-release:
runs-on: ubuntu-latest
needs: [build-debian-packages, build-ubuntu-packages, build-windows-installer]
steps:
- name: Download build artifacts
uses: actions/download-artifact@v7
with:
path: ~/artifacts
merge-multiple: true
- name: Calculate SHA-256 checksums
run: |
cd ~/artifacts
echo 'SHA-256 checksums' > notes.txt
echo '-----------------' >> notes.txt
echo -e '\n```' >> notes.txt
for file in $(find . -type f \( -name "*.exe" -o -name "*.zip" -o -name "*.deb" -o -name "*.rpm" \) | sort); do
filename=$(basename "$file")
checksum=$(sha256sum "$file" | awk '{print $1}')
echo "$checksum $filename" >> notes.txt
#echo $checksum > "$filename".sha256
done
echo -e '```\n' >> notes.txt
cd ..
tree ~/artifacts
- name: Setup Release Information
run: |
echo "RELEASE_NAME=${{ github.ref_name }}" >> $GITHUB_ENV
echo "TAG_NAME=${{ github.ref_name }}" >> $GITHUB_ENV
- name: Create GitHub Release
continue-on-error: false
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Find existing artifact files
hash_files=$(find ~/artifacts -name "*.sha256" -print0 | xargs -0 echo)
exe_files=$(find ~/artifacts -name "*.exe" -print0 | xargs -0 echo)
zip_files=$(find ~/artifacts -name "*.zip" -print0 | xargs -0 echo)
deb_files=$(find ~/artifacts -name "*.deb" -print0 | xargs -0 echo)
rpm_files=$(find ~/artifacts -name "*.rpm" -print0 | xargs -0 echo)
# Check existing release and delete if it's exist
if gh release view ${{ env.TAG_NAME }} --repo $GITHUB_REPOSITORY &> /dev/null; then
gh release delete ${{ env.TAG_NAME }} --repo $GITHUB_REPOSITORY
echo "${{ env.TAG_NAME }} deleted!"
fi
gh release create ${{ env.TAG_NAME }} \
--repo $GITHUB_REPOSITORY \
--draft \
--title "${{ env.RELEASE_NAME }}" \
--notes-file ~/artifacts/notes.txt \
$hash_files \
$exe_files \
$zip_files \
$deb_files \
$rpm_files