From b4213a20f75d18a44d49c8fa5197a06bc7561458 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tam=C3=A1s=20B=C3=A1lint=20Misius?= Date: Thu, 15 Sep 2022 11:52:04 +0200 Subject: [PATCH] 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. --- .github/prepare.py | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/.github/prepare.py b/.github/prepare.py index 3ce43f83d..362d2e32a 100755 --- a/.github/prepare.py +++ b/.github/prepare.py @@ -40,7 +40,7 @@ with open('.github/mod_id.txt') as f: build_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', '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 @@ -68,6 +68,12 @@ for bsh_host_arch, bsh_host_platform, bsh_host_libc, bsh_static_dynamic, bsh_bui assert artifact for debug_release in [ 'debug', '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({ '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 @@ -78,12 +84,12 @@ for bsh_host_arch, bsh_host_platform, bsh_host_libc, bsh_static_dynamic, bsh_bui 'runs_on': runs_on, 'package_suffix': package_suffix, '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', - '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}', + 'asset_path': asset_path, + 'asset_name': asset_name, + 'debug_asset_path': debug_asset_path, + 'debug_asset_name': debug_asset_name, }) if publish_release: 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_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 - 'asset_path': f'powder{package_suffix}', - 'asset_name': f'powder-{release_name}-{bsh_host_arch}-{bsh_host_platform}-{bsh_host_libc}{package_suffix}', - 'starcatcher_name': f'powder-{release_name}-{starcatcher_name}{package_suffix}', + 'asset_path': asset_path, + 'asset_name': asset_name, + 'starcatcher_name': starcatcher_name, }) print('::set-output name=build_matrix::' + json.dumps({ 'include': build_matrix }))