-
Notifications
You must be signed in to change notification settings - Fork 2
437 lines (386 loc) · 17 KB
/
release.yaml
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
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
name: create-github-release
on:
push:
branches: [ main ]
env:
# Used as the name when uploading or downloading the artifact for passing
# configuration data from the Setup job to those dependent on it.
CONFIG_ARTIFACT: release-config
# Used as the path for the file with the configuration data passed from
# the Setup job to those dependent on it.
CONFIG_ARTIFACT_PATH: release-config.txt
# Used as the name when uploading or downloading the artifact with the
# converted document files.
DOC_ARTIFACT: release-docs
# Used as the path for the file with the converted document files.
DOC_ARTIFACT_PATH: release-docs.tar
# Used as the name when uploading or downloading the artifact for passing
# the name of the source archive.
SRC_ARTIFACT: release-src
# Used as the path for the file with the name of the source archive in it.
SRC_ARTIFACT_PATH: release-src.txt
# Used as the name when uploading or downloading the artifact holding
# the source archive.
SRC_ARCHIVE_ARTIFACT: release-src-archive
# Used as the name when uploading or downloading the artifact for passing
# the name of the Windows archive.
WIN_ARTIFACT: release-win
# Used as the path for the file with the name of the Windows archive in it.
WIN_ARTIFACT_PATH: release-win.txt
# Used as the name when uploading or downloading the artifact holding
# the Windows archive.
WIN_ARCHIVE_ARTIFACT: release-win-archive
# Used as the name when uploading or downloading the artifact for passing
# the name of the Mac archive.
MAC_ARTIFACT: release-mac
# Used as the path for the file with the name of the Mac archive in it.
MAC_ARTIFACT_PATH: release-mac.txt
# Used as the name when uploading or downloading the artifact holding
# the Mac archive.
MAC_ARCHIVE_ARTIFACT: release-mac-archive
jobs:
setup:
name: Setup
runs-on: ubuntu-latest
steps:
# Need commit history and tags for scripts/version.sh to work as expected
# so use 0 for fetch-depth.
- name: Clone Project
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Extract Names from Makefile
id: get_names
run: |
name=`sed -E -n -e 's/^[[:blank:]]*NAME[[:blank:]]+=[[:blank:]]+//p' src/Makefile.src | tr ' #' '\t\t' | tail -1 | cut -f 1`
echo "name=$name" >> $GITHUB_OUTPUT
prog=`sed -E -n -e 's/^[[:blank:]]*PROGNAME[[:blank:]]+=[[:blank:]]+//p' src/Makefile.src | tr ' #' '\t\t' | tail -1 | cut -f 1`
echo "prog=$prog" >> $GITHUB_OUTPUT
- name: Set Release Version
id: get_release_vars
run: |
version=`scripts/version.sh`
echo "version=$version" >> $GITHUB_OUTPUT
prerelease=`echo $version | awk '/^[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+$/ { print "false" ; exit 0 } ; { print "true"; exit 0 } ;'`
echo "prerelease=$prerelease" >> $GITHUB_OUTPUT
# Mark anything that isn't a prerelease as a draft.
draft=true
if test x$prerelease = xtrue ; then
draft=false
fi
echo "draft=$draft" >> $GITHUB_OUTPUT
# The quoting here may be too simple-minded: what if there are single
# quotes in the steps.*.outputs.* stuff.
- name: Create Artifact with Configuration Details
run: |
echo name= '${{ steps.get_names.outputs.name }}' > $CONFIG_ARTIFACT_PATH
echo prog= '${{ steps.get_names.outputs.prog }}' >> $CONFIG_ARTIFACT_PATH
echo version= '${{ steps.get_release_vars.outputs.version }}' >> $CONFIG_ARTIFACT_PATH
echo prerelease= '${{ steps.get_release_vars.outputs.prerelease }}' >> $CONFIG_ARTIFACT_PATH
echo draft= '${{ steps.get_release_vars.outputs.draft }}' >> $CONFIG_ARTIFACT_PATH
- name: Upload Artifact for Use by Dependent Steps
uses: actions/upload-artifact@v4
with:
name: ${{ env.CONFIG_ARTIFACT }}
path: ${{ env.CONFIG_ARTIFACT_PATH }}
retention-days: 1
docconvert:
name: Document Conversion
runs-on: ubuntu-latest
steps:
# Need commit history and tags for scripts/version.sh to work as expected
# so use 0 for fetch-depth. Do this before installing the build
# dependencies as that step does some writing to the current directory
# and cloning the project wipes the current directory.
- name: Clone Project
uses: actions/checkout@v4
with:
fetch-depth: 0
# Need both Sphinx (Python documentation tool) and a 3rd party theme.
# Also install pip (to get theme), gcc, automake, autoconf, make
# (those four are so configuration and "make manual" work), and git
# (so scripts/version.sh works). With Python 3, use a virtual
# environment (requires at least Python 3.3) to install the 3rd party
# theme and a hacked version of sphinx-build which will use that
# environment for compatibility with "externally managed environments"
# like GitHub's runner for Ubuntu 24.04.
- name: Install Build Dependencies
id: build_dep
run: |
sudo apt-get update
sudo apt-get install autoconf automake gcc make sphinx-common git
use_python3=`python --version 2>&1 | awk "/^Python 3\\./ { print \"YES\" ; exit 0 ; } ; { print \"NO\" ; exit 0; }"`
if test X$use_python3 == XYES ; then
sudo apt-get install python3-pip
python3 -m venv .venv/doc-builder
.venv/doc-builder/bin/pip install -U sphinx
.venv/doc-builder/bin/pip install sphinx-better-theme
echo "#!${PWD}/.venv/doc-builder/bin/python" >./sphinx-build
tail -n +2 `which sphinx-build` >>./sphinx-build
chmod a+x ./sphinx-build
else
sudo apt-get install python-pip
pip install sphinx-better-theme
ln -s `which sphinx-build` ./sphinx-build
fi
# Use the version (perhaps just a symbolic link) of sphinx-build set up
# in the build dependencies step.
- name: Convert
run: |
./autogen.sh
./configure SPHINXBUILD="${PWD}/sphinx-build" --with-no-install --with-sphinx
make manual
- name: Archive
run: |
tar -cf ${{ env.DOC_ARTIFACT_PATH }} docs/_build/html
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.DOC_ARTIFACT }}
path: ${{ env.DOC_ARTIFACT_PATH }}
retention-days: 1
source:
needs: setup
name: Source Archive
runs-on: ubuntu-latest
steps:
- name: Download Artifact with Configuration Information
uses: actions/download-artifact@v4
with:
name: ${{ env.CONFIG_ARTIFACT }}
- name: Extract Configuration Information and Store in Step Outputs
id: store_config
run: |
name=`sed -E -n -e 's/name= //p' $CONFIG_ARTIFACT_PATH`
echo "name=$name" >> $GITHUB_OUTPUT
prog=`sed -E -n -e 's/prog= //p' $CONFIG_ARTIFACT_PATH`
echo "prog=$prog" >> $GITHUB_OUTPUT
version=`sed -E -n -e 's/version= //p' $CONFIG_ARTIFACT_PATH`
echo "version=$version" >> $GITHUB_OUTPUT
- name: Install Build Dependencies
run: |
sudo apt-get update
sudo apt-get install automake autoconf git make
# Need commit history and tags for scripts/version.sh to work as expected
# so use 0 for fetch-depth.
- name: Clone Project
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Create Source Archive
id: create_source_archive
run: |
./autogen.sh
./configure
archive_prefix=${{ steps.store_config.outputs.name }}-${{ steps.store_config.outputs.version }}
echo "archive_file=${archive_prefix}.tar.gz" >> $GITHUB_OUTPUT
make TAG="$archive_prefix" OUT="$archive_prefix".tar.gz dist
- name: Create Artifact with Source Archive Path
run: |
echo archive_path= '${{ steps.create_source_archive.outputs.archive_file }}' > $SRC_ARTIFACT_PATH
- name: Upload Artifact with Source Archive Path
uses: actions/upload-artifact@v4
with:
name: ${{ env.SRC_ARTIFACT }}
path: ${{ env.SRC_ARTIFACT_PATH }}
retention-days: 1
- name: Upload Source Archive as Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.SRC_ARCHIVE_ARTIFACT }}
path: ${{ steps.create_source_archive.outputs.archive_file }}
retention-days: 1
windows:
needs: [setup, docconvert]
name: Windows
runs-on: ubuntu-22.04
steps:
- name: Download Artifact with Configuration Information
uses: actions/download-artifact@v4
with:
name: ${{ env.CONFIG_ARTIFACT }}
- name: Extract Configuration Information and Store in Step Outputs
id: store_config
run: |
name=`sed -E -n -e 's/name= //p' $CONFIG_ARTIFACT_PATH`
echo "name=$name" >> $GITHUB_OUTPUT
prog=`sed -E -n -e 's/prog= //p' $CONFIG_ARTIFACT_PATH`
echo "prog=$prog" >> $GITHUB_OUTPUT
version=`sed -E -n -e 's/version= //p' $CONFIG_ARTIFACT_PATH`
echo "version=$version" >> $GITHUB_OUTPUT
- name: Install Build Dependencies
run: |
sudo apt-get update
sudo apt-get install gcc-mingw-w64 automake autoconf git make zip
# Need commit history and tags for scripts/version.sh to work as expected
# so use 0 for fetch-depth.
- name: Clone Project
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download Artifact with Converted Documents
uses: actions/download-artifact@v4
with:
name: ${{ env.DOC_ARTIFACT }}
- name: Extract Converted Documents
run: |
tar -xf ${{ env.DOC_ARTIFACT_PATH }}
# Override the default CFLAGS, -g -O2, to get a smaller executable (~2
# MB versus ~7 MB), all due to compiling without debugging symbols.
# Adding the option to strip symbols and relocation information, -s,
# or the option to optimize for size, -Os, didn't further reduce the
# size of the executable when using mingw 6.0.0 on Debian buster.
- name: Create Windows Archive
id: create_windows_archive
run: |
./autogen.sh
env CFLAGS="-O2" ./configure --enable-release --enable-win --build=i686-pc-linux-gnu --host=i686-w64-mingw32
make
cp src/${{ steps.store_config.outputs.prog }}.exe src/win/dll/libpng12.dll src/win/dll/zlib1.dll .
archive_prefix=${{ steps.store_config.outputs.name }}-${{ steps.store_config.outputs.version }}
echo "archive_file=${archive_prefix}-win.zip" >> $GITHUB_OUTPUT
scripts/pkg_win $archive_prefix ${archive_prefix}-win.zip
- name: Create Artifact with Windows Archive Path
run: |
echo archive_path= '${{ steps.create_windows_archive.outputs.archive_file }}' > $WIN_ARTIFACT_PATH
- name: Upload Artifact with Windows Archive Path
uses: actions/upload-artifact@v4
with:
name: ${{ env.WIN_ARTIFACT }}
path: ${{ env.WIN_ARTIFACT_PATH }}
retention-days: 1
- name: Upload Windows Archive as Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.WIN_ARCHIVE_ARTIFACT }}
path: ${{ steps.create_windows_archive.outputs.archive_file }}
retention-days: 1
mac:
needs: [setup, docconvert]
name: Mac
runs-on: macos-latest
steps:
- name: Download Artifact with Configuration Information
uses: actions/download-artifact@v4
with:
name: ${{ env.CONFIG_ARTIFACT }}
- name: Extract Configuration Information and Store in Step Outputs
id: store_config
run: |
name=`sed -E -n -e 's/name= //p' $CONFIG_ARTIFACT_PATH`
echo "name=$name" >> $GITHUB_OUTPUT
prog=`sed -E -n -e 's/prog= //p' $CONFIG_ARTIFACT_PATH`
echo "prog=$prog" >> $GITHUB_OUTPUT
version=`sed -E -n -e 's/version= //p' $CONFIG_ARTIFACT_PATH`
echo "version=$version" >> $GITHUB_OUTPUT
# Need commit history and tags for scripts/version.sh to work as expected
# so use 0 for fetch-depth.
- name: Clone Project
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download Artifact with Converted Documents
uses: actions/download-artifact@v4
with:
name: ${{ env.DOC_ARTIFACT }}
- name: Extract Converted Documents
run: |
tar -xf ${{ env.DOC_ARTIFACT_PATH }}
# An SDK that supports building x86_64 and arm64 objects is currently
# necessary unless the default list of architectures, ARCHS, in
# Makefile.osx is overridden. If the default SDK does not handle that,
# setting SDKROOT to point to an installed SDK that does would be one
# workaround. Override the default OPT (-O2) to get the equivalent of
# what --enable-release does for builds using configure.
- name: Create Mac Archive
id: create_mac_archive
run: |
cd src
env OPT="-O2 -DNDEBUG" make -f Makefile.osx dist
archive_prefix=${{ steps.store_config.outputs.name }}-${{ steps.store_config.outputs.version }}-osx
echo "archive_file=${archive_prefix}.dmg" >> $GITHUB_OUTPUT
- name: Create Artifact with Mac Archive Path
run: |
echo archive_path= '${{ steps.create_mac_archive.outputs.archive_file }}' > $MAC_ARTIFACT_PATH
- name: Upload Artifact with Mac Archive Path
uses: actions/upload-artifact@v4
with:
name: ${{ env.MAC_ARTIFACT }}
path: ${{ env.MAC_ARTIFACT_PATH }}
retention-days: 1
- name: Upload Mac Archive as Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.MAC_ARCHIVE_ARTIFACT }}
path: ${{ steps.create_mac_archive.outputs.archive_file }}
retention-days: 1
release:
needs: [ setup, source, windows, mac ]
name: Create GitHub Release
runs-on: ubuntu-latest
steps:
- name: Download Artifact with Configuration Information
uses: actions/download-artifact@v4
with:
name: ${{ env.CONFIG_ARTIFACT }}
- name: Extract Configuration Information and Store in Step Outputs
id: store_config
run: |
version=`sed -E -n -e 's/version= //p' $CONFIG_ARTIFACT_PATH`
echo "version=$version" >> $GITHUB_OUTPUT
prerelease=`sed -E -n -e 's/prerelease= //p' $CONFIG_ARTIFACT_PATH`
echo "prerelease=$prerelease" >> $GITHUB_OUTPUT
draft=`sed -E -n -e 's/draft= //p' $CONFIG_ARTIFACT_PATH`
echo "draft=$draft" >> $GITHUB_OUTPUT
- name: Download Artifact with Source Archive Path
uses: actions/download-artifact@v4
with:
name: ${{ env.SRC_ARTIFACT }}
- name: Extract Source Archive Path and Store in Step Outputs
id: store_src
run: |
archive_path=`sed -E -n -e 's/archive_path= //p' $SRC_ARTIFACT_PATH`
echo "archive_path=$archive_path" >> $GITHUB_OUTPUT
- name: Download Artifact with Source Archive
uses: actions/download-artifact@v4
with:
name: ${{ env.SRC_ARCHIVE_ARTIFACT }}
- name: Download Artifact with Windows Archive Path
uses: actions/download-artifact@v4
with:
name: ${{ env.WIN_ARTIFACT }}
- name: Extract Windows Archive Path and Store in Step Outputs
id: store_win
run: |
archive_path=`sed -E -n -e 's/archive_path= //p' $WIN_ARTIFACT_PATH`
echo "archive_path=$archive_path" >> $GITHUB_OUTPUT
- name: Download Artifact with Windows Archive
uses: actions/download-artifact@v4
with:
name: ${{ env.WIN_ARCHIVE_ARTIFACT }}
- name: Download Artifact with Mac Archive Path
uses: actions/download-artifact@v4
with:
name: ${{ env.MAC_ARTIFACT }}
- name: Extract Mac Archive Path and Store in Step Outputs
id: store_mac
run: |
archive_path=`sed -E -n -e 's/archive_path= //p' $MAC_ARTIFACT_PATH`
echo "archive_path=$archive_path" >> $GITHUB_OUTPUT
- name: Download Artifact with Mac Archive
uses: actions/download-artifact@v4
with:
name: ${{ env.MAC_ARCHIVE_ARTIFACT }}
- name: Populate Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.store_config.outputs.version }}
name: ${{ steps.store_config.outputs.version }}
target_commitish: ${{ github.sha }}
draft: ${{ steps.store_config.outputs.draft }}
prerelease: ${{ steps.store_config.outputs.prerelease }}
files: |
${{ steps.store_src.outputs.archive_path }}
${{ steps.store_win.outputs.archive_path }}
${{ steps.store_mac.outputs.archive_path }}
token: ${{ secrets.GITHUB_TOKEN }}