-
Notifications
You must be signed in to change notification settings - Fork 20
314 lines (285 loc) · 10.4 KB
/
Copy pathrelease.yml
File metadata and controls
314 lines (285 loc) · 10.4 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
304
305
306
307
308
309
310
311
312
313
314
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
on:
push:
tags:
- '*'
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
# Problems with Debian 9, Ubuntu 18 and older:
# - Repositories are not available for Debian 9 and it is not possible
# to install the required packages.
# - Both Debian 9 and Ubuntu 18 (and older) do not work with Node20.
# It is possible to rollback to Node16 using
# env:ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true, but in this case
# the unloading of received artefacts does not work.
# Errors while actions/checkout@v3 or actions/upload-artifact@v4:
# /__e/node20/bin/node: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.27' not found (required by /__e/node20/bin/node)
# /__e/node20/bin/node: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.28' not found (required by /__e/node20/bin/node)
# /__e/node20/bin/node: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.25' not found (required by /__e/node20/bin/node)
# https://github.com/actions/checkout/issues/1590
# https://github.blog/changelog/2024-03-07-github-actions-all-actions-will-run-on-node20-instead-of-node16-by-default/
jobs:
setup:
runs-on: ubuntu-22.04
outputs:
version: ${{ steps.get_version.outputs.version }}
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Extract version
id: get_version
run: |
if [ "${{github.ref_type}}" = "tag" ]; then
VERSION="$(echo ${{ github.ref_name }} | grep -Eo '[[:digit:]]+.*')"
else
VERSION="$(git rev-parse --short HEAD)"
fi
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Print version
run: echo "Version is \"${{ env.VERSION }}\""
# https://en.wikipedia.org/wiki/Debian_version_history
# https://hub.docker.com/_/debian
build-debian-packages:
runs-on: ubuntu-22.04
needs: setup
strategy:
fail-fast: false
matrix:
distr:
- name: trixie
version: 13
artifact: "Qt5"
extra_pack: "qtwebengine5-dev"
flags: "-w webengine"
- name: trixie
version: 13
artifact: "Qt6"
extra_pack: "qt6-webengine-dev qt6-5compat-dev"
flags: "-q qmake6 -w webengine"
- name: bookworm
version: 12
artifact: "Qt5"
extra_pack: "libqt5webkit5-dev"
flags: ""
- name: bullseye
version: 11
artifact: "Qt5"
extra_pack: "libqt5webkit5-dev"
flags: ""
#- name: buster
# version: 10
# extra_pack: "qt5-default qtbase5-dev libqt5webkit5-dev"
# flags: ""
arch:
- name: amd64
id: linux/amd64
container:
image: debian:${{matrix.distr.name}}
options: --platform ${{matrix.arch.id}}
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Install dependencies
run: |
apt-get update
# https://serverfault.com/a/992421
DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get install -y build-essential gettext libzip-dev libchm-dev ${{matrix.distr.extra_pack}}
- name: Build
run: packages/build-deb.sh ${{matrix.distr.flags}} -s debian-${{matrix.distr.name}} -v ${{ needs.setup.outputs.version }}
- name: Upload debian packages
uses: actions/upload-artifact@v6
with:
name: debian-${{matrix.distr.name}}-${{matrix.distr.artifact}}-${{matrix.arch.name}}
path: '*.deb'
# https://en.wikipedia.org/wiki/Ubuntu_version_history
# https://hub.docker.com/_/ubuntu
build-ubuntu-packages:
runs-on: ubuntu-22.04
needs: setup
strategy:
fail-fast: false
matrix:
distr:
- name: noble
version: 24.04
artifact: "Qt5"
extra_pack: "libqt5webkit5-dev"
flags: ""
- name: jammy
version: 22.04
artifact: "Qt5"
extra_pack: "libqt5webkit5-dev"
flags: ""
- name: focal
version: 20.04
artifact: "Qt5"
extra_pack: "qt5-default libqt5webkit5-dev"
flags: ""
arch:
- name: amd64
id: linux/amd64
container:
image: ubuntu:${{matrix.distr.name}}
options: --platform ${{matrix.arch.id}}
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Install Dependencies
run: |
apt-get update
DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get install -y build-essential gettext libzip-dev libchm-dev ${{matrix.distr.extra_pack}}
- name: Build
run: packages/build-deb.sh ${{matrix.distr.flags}} -s ubuntu-${{matrix.distr.name}} -v ${{ needs.setup.outputs.version }}
- 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
needs: setup
strategy:
fail-fast: false
matrix:
distr:
- version: 43
artifact: "Qt5"
extra_pack: "qt5-qtwebkit-devel"
flags: "-q qmake-qt5"
- version: 42
artifact: "Qt5"
extra_pack: "qt5-qtwebkit-devel"
flags: "-q qmake-qt5"
- version: 41
artifact: "Qt5"
extra_pack: "qt5-qtwebkit-devel"
flags: "-q qmake-qt5"
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 cmake git gettext libzip-devel chmlib-devel rpm-build ${{matrix.distr.extra_pack}}
- name: Build
run: packages/build-rpm.sh ${{matrix.distr.flags}} -s fedora-${{matrix.distr.version}} -v ${{ needs.setup.outputs.version }}
- 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
needs: setup
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
with:
submodules: true
- name: Set up MSYS2 environment
uses: msys2/setup-msys2@v2
with:
msystem: ${{matrix.msystem}}
cache: true
update: true
install: >-
make
zip
pacboy: >-
gcc:p
nsis:p
ntldd:p
libzip:p
qt5-base:p
qt5-translations:p
qtwebkit:p
gettext-runtime:p
gettext-tools:p
- name: Build
run: packages/build-win-msys2.sh -q qmake-qt5 -s windows -v ${{ needs.setup.outputs.version }}
- name: Upload windows installers
uses: actions/upload-artifact@v6
with:
name: windows-${{matrix.msystem}}
path: |
*.exe
*.zip
create-release:
runs-on: ubuntu-22.04
needs: [build-debian-packages, build-ubuntu-packages, build-fedora-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