Skip to content

Commit 143f641

Browse files
authored
Changes to build-release.yaml (#4044)
* Try using softprops/action-gh-release * Try *_path instead of *_name * Document action dependencies * Use consistent versioning in some places * Maybe continue windows_zip should an upload fail * Skip building standalone image if not on source repo. * Stash the windows zips to artifact ftp in case the publish steps fail. * Combine publish steps into one step
1 parent 0b0f323 commit 143f641

File tree

2 files changed

+99
-25
lines changed

2 files changed

+99
-25
lines changed

.github/workflows/build-release.yaml

Lines changed: 98 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,17 @@ jobs:
1616
- name: Create Release
1717
id: create_release
1818
uses: actions/create-release@v1
19+
# Creates a release package page on github
20+
# create_release.inputs: (notable inputs)
21+
# allowUpdates=false if true, update an existing release if it exists
22+
# artifactErrorsFailBuild=false if true, fails the build should artifact read/write errors occur
23+
# artifacts optional set of paths to artifacts to upload to the release. comma delimited.
24+
# removeArtifacts=false if true, remove existing artifacts
25+
# replaceArtifacts=false if true, replace/overwrite existing artifacts
26+
# create_release.outputs:
27+
# id id of the created release
28+
# html_url HTML URL of the release
29+
# upload_url FTP URL of the release where assets are uploaded
1930
env:
2031
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
2132
with:
@@ -28,27 +39,65 @@ jobs:
2839
echo -n "${{ steps.create_release.outputs.upload_url }}" > upload_url
2940
- name: Persist upload URL
3041
uses: actions/upload-artifact@v2
42+
# Upload the url file for use with other runners
43+
# upload-artifact.inputs:
44+
# if-no-files-found=warn What to do if path fails to find any files.
45+
# warn Display a warning but do not fail the action
46+
# error Display an error and fail the action
47+
# ignore No display, No fail
48+
# retention-days=0 Days to keep the artifact.
49+
# 0 Use default retention policy of the repo
50+
# 1~90 Min 1, Max 90 days to keep the artifact unless changed by repo settings page
3151
with:
32-
name: upload_url
33-
path: ${{ github.workspace }}/upload_url
52+
name: upload_url # name of artifact
53+
path: ${{ github.workspace }}/upload_url # source location of artifact to upload
3454

3555
build_linux:
3656
strategy:
3757
matrix:
58+
# Run this job for each configuration
59+
# The current config running is accesible with `matrix.configuration`
3860
configuration: [FastDebug, Release]
3961
name: Linux
40-
needs: create_release
62+
needs: create_release # Don't run this job until create_release is done and successful
4163
runs-on: ubuntu-latest
4264
container: ghcr.io/scp-fs2open/linux_build:sha-11e553c
4365
steps:
4466
- name: Cache Qt
4567
id: cache-qt-lin
4668
uses: actions/cache@v1
69+
# cache the Qt directory so we don't have to reinstall it every time
70+
# cache.inputs:
71+
# path - A list of files, directories, and wildcard patterns to cache and restore. See @actions/glob for supported patterns.
72+
# key - An explicit key for restoring and saving the cache
73+
# restore-keys - An ordered list of keys to use for restoring the cache if no cache hit occurred for key
74+
# cache.outputs:
75+
# cache-hit true when an exact match was found for the key, false otherwise.
4776
with:
4877
path: ${{ github.workspace }}/../Qt
4978
key: ${{ runner.os }}-QtCache-${{ env.QT_VERSION }}
5079
- name: Install Qt
5180
uses: jurplel/install-qt-action@v2
81+
# installs Qt in the action workflow
82+
# install-qt-action.inputs:
83+
# version desired qt version to install
84+
# host Host platform of Qt, default to platform used by runs-on
85+
# target target platform of Qt, default to desktop
86+
# arch target architecture of Qt, only used for windows or android builds
87+
# dir root dir Qt will be installed to
88+
# install-deps if true, auto-install dependencies on linux. Default true
89+
# modules whitespace delimited list string of additional addon modules to install
90+
# archives whitespace delimited list string of Qt archives to install
91+
# cached if true, Don't download Qt but set ENVARs; use with cache.outputs.cache-hit
92+
# setup-python Set to false to skip using setup-python to find/download a valid python version
93+
# set-env if true, set ENVARs; default = false
94+
# aqtversion version of aqtinstall to use; default = 2.0.0
95+
# py7zrversion version of py7zr to use; default = 0.16.1
96+
# extra additional arguments to pass to aqinstall
97+
# ENVARS set:
98+
# Qt5_DIR / Qt6_DIR
99+
# Qt bin dir appended to PATH
100+
# QT_PLUGIN_PATH, QML2_IMPORT_PATH, PKG_CONFIG_PATH, LD_LIBRARY_PATH
52101
with:
53102
version: ${{ env.QT_VERSION }}
54103
dir: ${{ github.workspace }}/..
@@ -57,9 +106,10 @@ jobs:
57106
aqtversion: ==1.1.3
58107

59108
- uses: actions/checkout@v1
109+
# checks-out your repository under $GITHUB_WORKSPACE, so your workflow can access it.
60110
name: Checkout
61111
with:
62-
submodules: true
112+
submodules: true # `true` to checkout submodules, `recursive` to recursively checkout submodules
63113
- name: Configure CMake
64114
env:
65115
CONFIGURATION: ${{ matrix.configuration }}
@@ -97,38 +147,46 @@ jobs:
97147
name: Checkout
98148
with:
99149
submodules: true
100-
fetch-depth: '0'
150+
fetch-depth: '0' # value 0 to fetch all history and tags for all branches
101151
- name: Download upload URL
102152
uses: actions/download-artifact@v1
153+
# Downloads and extracts uploaded artifact by name
154+
# github_token default ${{secrets.GITHUB_TOKEN}}
155+
# name name of artifact to download
156+
# latest Download latest artifact (default true)
157+
# path Where to save the artifact, (default extract_here)
158+
# repo Source repo of artifact (default ${{github.repository}})
103159
with:
104160
name: upload_url
105161
path: .
106162
- name: Extract upload URL
163+
# Extract the URL from file and stuff it into a shell variable
107164
id: extractUploadUrl
108165
run: echo "::set-output name=upload_url::$(cat upload_url)"
109166
- name: Download Release builds
110-
uses: actions/download-artifact@v1
167+
# Grab the release builds
168+
uses: actions/download-artifact@v2
111169
with:
112170
name: linux-Release
113171
path: builds
114172
- name: Download FastDebug builds
173+
# Grab the debug builds
115174
uses: actions/download-artifact@v2
116175
with:
117176
name: linux-FastDebug
118177
path: builds
119178
- name: Create Distribution package
179+
# Zip both builds together
120180
id: generate_package
121181
working-directory: ./builds
122182
run: $GITHUB_WORKSPACE/ci/linux/create_dist_pack.sh Linux
123183
- name: Upload result package
124-
uses: actions/upload-release-asset@v1
184+
# publish the zipped result
185+
uses: softprops/action-gh-release@v1
125186
env:
126187
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
127188
with:
128-
upload_url: ${{ steps.extractUploadUrl.outputs.upload_url }}
129-
asset_path: ${{ steps.generate_package.outputs.package_path }}
130-
asset_name: ${{ steps.generate_package.outputs.package_name }}
131-
asset_content_type: ${{ steps.generate_package.outputs.package_mime }}
189+
files: ${{ steps.generate_package.outputs.package_path }}
132190

133191
build_windows:
134192
strategy:
@@ -141,16 +199,19 @@ jobs:
141199
runs-on: windows-2019
142200
steps:
143201
- uses: actions/checkout@v1
202+
# Checkout repo
144203
name: Checkout
145204
with:
146205
submodules: true
147206
- name: Cache Qt
207+
# Cache Qt
148208
id: cache-qt-win
149209
uses: actions/cache@v1
150210
with:
151211
path: ${{ github.workspace }}/../Qt
152212
key: ${{ runner.os }}-${{ matrix.arch }}-QtCache-${{ env.QT_VERSION }}
153213
- name: Install Qt (32 bit)
214+
# Install Qt 32bit if matrix.arch == Win32
154215
uses: jurplel/install-qt-action@v2
155216
if: ${{ matrix.arch == 'Win32' }}
156217
with:
@@ -160,6 +221,7 @@ jobs:
160221
cached: ${{ steps.cache-qt-win.outputs.cache-hit }}
161222
aqtversion: ==0.8
162223
- name: Install Qt (64 bit)
224+
# Install Qt 64bit if matrix.arch == x64
163225
uses: jurplel/install-qt-action@v2
164226
if: ${{ matrix.arch == 'x64' }}
165227
with:
@@ -204,39 +266,47 @@ jobs:
204266
with:
205267
name: windows-${{ matrix.configuration }}-${{ matrix.arch }}-${{ matrix.simd }}
206268
path: ${{ github.workspace }}/build/install/*
269+
207270
windows_zip:
208271
name: Build Windows distribution zip
209272
needs: build_windows
210273
runs-on: ubuntu-latest
211274
container: ghcr.io/scp-fs2open/sftp_upload:sha-748b19d
212275
strategy:
276+
fail-fast: false # Run the other jobs in the matrix instead of failing them
213277
matrix:
214278
arch: [Win32, x64]
215279
simd: [SSE2, AVX]
280+
216281
steps:
217282
- uses: actions/checkout@v1
218283
name: Checkout
219284
with:
220285
submodules: true
221286
fetch-depth: '0'
287+
222288
- name: Download upload URL
223289
uses: actions/download-artifact@v1
224290
with:
225291
name: upload_url
226292
path: .
293+
227294
- name: Extract upload URL
228295
id: extractUploadUrl
229296
run: echo "::set-output name=upload_url::$(cat upload_url)"
297+
230298
- name: Download Release builds
231-
uses: actions/download-artifact@v1
299+
uses: actions/download-artifact@v2
232300
with:
233301
name: windows-Release-${{ matrix.arch }}-${{ matrix.simd }}
234302
path: builds
303+
235304
- name: Download FastDebug builds
236305
uses: actions/download-artifact@v2
237306
with:
238307
name: windows-FastDebug-${{ matrix.arch }}-${{ matrix.simd }}
239308
path: builds
309+
240310
- name: Create Distribution package
241311
id: generate_package
242312
working-directory: ./builds
@@ -245,21 +315,24 @@ jobs:
245315
ARCH: ${{ matrix.arch }}
246316
SIMD: ${{ matrix.simd }}
247317
run: $GITHUB_WORKSPACE/ci/linux/create_dist_pack.sh Windows
318+
248319
- name: Upload result package
249-
uses: actions/upload-release-asset@v1
250-
env:
251-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
320+
uses: actions/upload-artifact@v2
252321
with:
253-
upload_url: ${{ steps.extractUploadUrl.outputs.upload_url }}
254-
asset_path: ${{ steps.generate_package.outputs.package_path }}
255-
asset_name: ${{ steps.generate_package.outputs.package_name }}
256-
asset_content_type: ${{ steps.generate_package.outputs.package_mime }}
257-
- name: Upload debug symbols
258-
uses: actions/upload-release-asset@v1
322+
name: ${{ steps.generate_package.outputs.package_name }}
323+
path: ${{ steps.generate_package.outputs.package_path }}
324+
325+
- name: Upload debug package
326+
uses: actions/upload-artifact@v2
327+
with:
328+
name: ${{ steps.generate_package.outputs.debug_name }}
329+
path: ${{ steps.generate_package.outputs.debug_path }}
330+
331+
- name: Publish packages
332+
uses: softprops/action-gh-release@v1
259333
env:
260334
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
261335
with:
262-
upload_url: ${{ steps.extractUploadUrl.outputs.upload_url }}
263-
asset_path: ${{ steps.generate_package.outputs.debug_path }}
264-
asset_name: ${{ steps.generate_package.outputs.debug_name }}
265-
asset_content_type: ${{ steps.generate_package.outputs.debug_mime }}
336+
files: |
337+
${{ steps.generate_package.outputs.package_path }}
338+
${{ steps.generate_package.outputs.debug_path }}

.github/workflows/standalone-image-workflow.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88

99
jobs:
1010
build_images:
11+
if: github.repository == 'scp-fs2open/fs2open.github.com'
1112
strategy:
1213
matrix:
1314
configuration: [FastDebug, Release]

0 commit comments

Comments
 (0)