Fix workflow sometimes releasing debug builds

Both the debug and release jobs would upload artifacts, with the same name, which ghactions of course accepted without question. Snapshot 240 happens to have been released correctly (so all binaries are release builds), but that's just luck. I'd thought I'd fixed this problem with another commit, but turns out I hadn't.

Also factor out a bunch of variables so I won't mess up in the future.
This commit is contained in:
Tamás Bálint Misius 2022-09-15 11:52:04 +02:00
parent 25d6ca9dec
commit b4213a20f7
No known key found for this signature in database
GPG Key ID: 5B472A12F6ECA9F2

24
.github/prepare.py vendored
View File

@ -40,7 +40,7 @@ with open('.github/mod_id.txt') as f:
build_matrix = [] build_matrix = []
publish_matrix = [] publish_matrix = []
for bsh_host_arch, bsh_host_platform, bsh_host_libc, bsh_static_dynamic, bsh_build_platform, runs_on, package_suffix, publish, artifact, debug_suffix, starcatcher_name in [ for bsh_host_arch, bsh_host_platform, bsh_host_libc, bsh_static_dynamic, bsh_build_platform, runs_on, package_suffix, publish, artifact, debug_suffix, starcatcher_suffix in [
( 'x86_64', 'linux', 'gnu', 'static', 'linux', 'ubuntu-18.04', '', True, True, '.dbg', 'x86_64-lin-gcc-static' ), ( 'x86_64', 'linux', 'gnu', 'static', 'linux', 'ubuntu-18.04', '', True, True, '.dbg', 'x86_64-lin-gcc-static' ),
( 'x86_64', 'linux', 'gnu', 'dynamic', 'linux', 'ubuntu-18.04', '', False, False, None, '' ), ( 'x86_64', 'linux', 'gnu', 'dynamic', 'linux', 'ubuntu-18.04', '', False, False, None, '' ),
# ( 'x86_64', 'windows', 'mingw', 'static', 'linux', 'ubuntu-20.04', '', False, True, '.dbg', '' ), # ubuntu-20.04 doesn't have windows TLS headers somehow and I haven't yet figured out how to get them # ( 'x86_64', 'windows', 'mingw', 'static', 'linux', 'ubuntu-20.04', '', False, True, '.dbg', '' ), # ubuntu-20.04 doesn't have windows TLS headers somehow and I haven't yet figured out how to get them
@ -68,6 +68,12 @@ for bsh_host_arch, bsh_host_platform, bsh_host_libc, bsh_static_dynamic, bsh_bui
assert artifact assert artifact
for debug_release in [ 'debug', 'release' ]: for debug_release in [ 'debug', 'release' ]:
publish_release = publish and debug_release == 'release' publish_release = publish and debug_release == 'release'
artifact_release = artifact and debug_release == 'release'
asset_path = f'powder{package_suffix}'
asset_name = f'powder-{release_name}-{bsh_host_arch}-{bsh_host_platform}-{bsh_host_libc}{package_suffix}'
debug_asset_path = f'powder{debug_suffix}'
debug_asset_name = f'powder-{release_name}-{bsh_host_arch}-{bsh_host_platform}-{bsh_host_libc}{debug_suffix}'
starcatcher_name = f'powder-{release_name}-{starcatcher_suffix}{package_suffix}'
build_matrix.append({ build_matrix.append({
'bsh_build_platform': bsh_build_platform, # part of the unique portion of the matrix 'bsh_build_platform': bsh_build_platform, # part of the unique portion of the matrix
'bsh_host_arch': bsh_host_arch, # part of the unique portion of the matrix 'bsh_host_arch': bsh_host_arch, # part of the unique portion of the matrix
@ -78,12 +84,12 @@ for bsh_host_arch, bsh_host_platform, bsh_host_libc, bsh_static_dynamic, bsh_bui
'runs_on': runs_on, 'runs_on': runs_on,
'package_suffix': package_suffix, 'package_suffix': package_suffix,
'publish': publish_release and 'yes' or 'no', 'publish': publish_release and 'yes' or 'no',
'artifact': artifact and 'yes' or 'no', 'artifact': artifact_release and 'yes' or 'no',
'separate_debug': separate_debug and 'yes' or 'no', 'separate_debug': separate_debug and 'yes' or 'no',
'asset_path': f'powder{package_suffix}', 'asset_path': asset_path,
'asset_name': f'powder-{release_name}-{bsh_host_arch}-{bsh_host_platform}-{bsh_host_libc}{package_suffix}', 'asset_name': asset_name,
'debug_asset_path': f'powder{debug_suffix}', 'debug_asset_path': debug_asset_path,
'debug_asset_name': f'powder-{release_name}-{bsh_host_arch}-{bsh_host_platform}-{bsh_host_libc}{debug_suffix}', 'debug_asset_name': debug_asset_name,
}) })
if publish_release: if publish_release:
publish_matrix.append({ publish_matrix.append({
@ -92,9 +98,9 @@ for bsh_host_arch, bsh_host_platform, bsh_host_libc, bsh_static_dynamic, bsh_bui
'bsh_host_platform': bsh_host_platform, # part of the unique portion of the matrix 'bsh_host_platform': bsh_host_platform, # part of the unique portion of the matrix
'bsh_host_libc': bsh_host_libc, # part of the unique portion of the matrix 'bsh_host_libc': bsh_host_libc, # part of the unique portion of the matrix
'bsh_static_dynamic': bsh_static_dynamic, # part of the unique portion of the matrix 'bsh_static_dynamic': bsh_static_dynamic, # part of the unique portion of the matrix
'asset_path': f'powder{package_suffix}', 'asset_path': asset_path,
'asset_name': f'powder-{release_name}-{bsh_host_arch}-{bsh_host_platform}-{bsh_host_libc}{package_suffix}', 'asset_name': asset_name,
'starcatcher_name': f'powder-{release_name}-{starcatcher_name}{package_suffix}', 'starcatcher_name': starcatcher_name,
}) })
print('::set-output name=build_matrix::' + json.dumps({ 'include': build_matrix })) print('::set-output name=build_matrix::' + json.dumps({ 'include': build_matrix }))