From 28cdf1f727e71cfda34b9625ffad71e8fdf04df6 Mon Sep 17 00:00:00 2001 From: David Spickett Date: Tue, 11 Nov 2025 15:19:31 +0000 Subject: [PATCH 01/11] [llvm][release] Reveal download links based on uploaded assets For the 21.x release, download links were supposed to be revealed once all the release builds had completed. In reality, MacOS never had a succesfull build so I had to hand edit the release messages. This PR fixes this by focusing instead on what is in the release assets. 1. Links are now built from a format string, with the linked files being format arguments for that string. This is a balance between ease of editing the format, and having the file names for use later. (I tried regex-ing file names out of the final links, which can work but is error prone and will be hard to debug in production) 2. uncomment_download_links now looks at the release assets to decide whether to reveal a given link line. If all the files that line links to are present, it can be revealed. This means we can still run this at the end of release-tasks.yml, where it will be atomic. Intially I was going to accumulate the statuses from the release build matrix job, but this does not seem to be possible (https://github.com/orgs/community/discussions/17245). Workarounds for this often include uploading artefacts from each job, which is for us, the same as checking the release's assets. This process is done for all assets we would like to link to, not just the ones currently built in GitHub. So if some become automatically built, they will "just work". If we want to hand edit the links in, that's still an option because the full links are in the release message, but hidden from view. As we are looking for "" + markdown_lines.append(markdown_line) + + # Blank line between each section. + markdown_lines.append("") + + return "\n".join(markdown_lines) + + def create_release(repo, release, tag=None, name=None, message=None): if not tag: tag = "llvmorg-{}".format(release) @@ -45,33 +142,15 @@ def create_release(repo, release, tag=None, name=None, message=None): # Note that these lines are not length limited because if we do so, GitHub # assumes that should be how it is laid out on the page. We want GitHub to # do the reflowing for us instead. - # - # Once all the atuomatic binary builds have completed, the HTML comments - # with UPPERCASE markers in them will be removed to reveal the download - # links later. Other lines are surrounded in for release uploaders - # to manually uncomment when they upload that package. + download_links = generate_download_links(release) message = dedent( - """\ + f"""\ ## LLVM {release} Release - - - - - - - - +{download_links} +Download links for common platforms will appear above, if they are available. Check the full list of release packages at the bottom of this release page if you do not find a link above. -Download links will appear here once builds have completed. - -For any other variants of platform and architecture, check the full list of release packages at the bottom of this release page. If you do not find a release package for your platform, you may be able to find a community built package on the LLVM Discourse forum thread for this release. Remember that these are built by volunteers and may not always be available. If you rely on a platform or configuration that is not one of the defaults, we suggest you use the binaries that your platform provides, or build your own release packages. +If you do not find a release package for your platform, you may be able to find a community built package on the LLVM Discourse forum thread for this release. Remember that these are built by volunteers and may not always be available. If you rely on a platform or configuration that is not one of the defaults, we suggest you use the binaries that your platform provides, or build your own release packages. ## Package Types @@ -100,7 +179,7 @@ def create_release(repo, release, tag=None, name=None, message=None): $ gh attestation verify --repo llvm/llvm-project --bundle .jsonl (using attestation file on disk) ```""" - ).format(release=release) + ) prerelease = True if "rc" in release else False @@ -115,28 +194,48 @@ def upload_files(repo, release, files): print("Done") -def uncomment_download_links(repo, release): - release = repo.get_release("llvmorg-{}".format(release)) +def uncomment_download_links(repo, release_version): + release = repo.get_release("llvmorg-{}".format(release_version)) + + # At this point any automatic builds have finished and if + # they succeeded, uploaded files to the release assets. + release_assets = set([a.name for a in release.assets]) + print("Found release assets: ", release_assets) new_message = [] - to_remove = [ - "AUTOMATIC_DOWNLOAD_LINKS_BEGIN", - "AUTOMATIC_DOWNLOAD_LINKS_END", - "AUTOMATIC_DOWNLOAD_LINKS_PLACEHOLDER", - ] + modified = False for line in release.body.splitlines(): - for comment in to_remove: - if comment in line: - break - else: - new_message.append(line) - - release.update_release( - name=release.title, - message="\n".join(new_message), - draft=release.draft, - prerelease=release.prerelease, - ) + # All hidden download links are of the form: + # + if line.startswith("", "" + ).strip() + modified = True + else: + print( + " These files are not present:", + files.difference(release_assets), + ) + print(" Link line will remain hidden.") + + new_message.append(line) + + if modified: + release.update_release( + name=release.title, + message="\n".join(new_message), + draft=release.draft, + prerelease=release.prerelease, + ) parser = argparse.ArgumentParser() From 8e9c7992da33d181d9562d87e3e7c6319fee93eb Mon Sep 17 00:00:00 2001 From: David Spickett Date: Thu, 13 Nov 2025 09:31:45 +0000 Subject: [PATCH 02/11] fix macos intel link syntax --- llvm/utils/release/github-upload-release.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llvm/utils/release/github-upload-release.py b/llvm/utils/release/github-upload-release.py index 9dac8c6440fec..958eba094dbde 100755 --- a/llvm/utils/release/github-upload-release.py +++ b/llvm/utils/release/github-upload-release.py @@ -78,7 +78,7 @@ ), ( "MACOS_X86", - "* [macOS Intel]({0}) (x86-64) ([signature]({1})])", + "* [macOS Intel]({0}) (x86-64) ([signature]({1}))", "LLVM-{release}-macOS-X64.tar.xz", "LLVM-{release}-macOS-X64.tar.xz.jsonl", ), From dd711a9c30d68cb10411286e7aa0e49e32a59ba1 Mon Sep 17 00:00:00 2001 From: David Spickett Date: Wed, 19 Nov 2025 10:06:37 +0000 Subject: [PATCH 03/11] Must run even if part of release-binaries fails --- .github/workflows/release-tasks.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/release-tasks.yml b/.github/workflows/release-tasks.yml index d4c2a55fcc9d7..df6b04803bbf5 100644 --- a/.github/workflows/release-tasks.yml +++ b/.github/workflows/release-tasks.yml @@ -120,9 +120,8 @@ jobs: runs-on: ubuntu-24.04 permissions: contents: write # For updating the release message. + if: always() needs: - - validate-tag - - release-create - release-binaries steps: From 47eca391fff3546713b7da919cf906b298b1862a Mon Sep 17 00:00:00 2001 From: David Spickett Date: Wed, 19 Nov 2025 10:08:38 +0000 Subject: [PATCH 04/11] On second thought, always run but not if someone cancelled the pipeline. --- .github/workflows/release-tasks.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-tasks.yml b/.github/workflows/release-tasks.yml index df6b04803bbf5..0ce3fe903e627 100644 --- a/.github/workflows/release-tasks.yml +++ b/.github/workflows/release-tasks.yml @@ -120,7 +120,7 @@ jobs: runs-on: ubuntu-24.04 permissions: contents: write # For updating the release message. - if: always() + if: '!cancelled()' needs: - release-binaries From 83a4c5c00a85a1c4818e7ed99fd15b23a25a4a68 Mon Sep 17 00:00:00 2001 From: David Spickett Date: Thu, 20 Nov 2025 13:44:13 +0000 Subject: [PATCH 05/11] use f string --- llvm/utils/release/github-upload-release.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llvm/utils/release/github-upload-release.py b/llvm/utils/release/github-upload-release.py index 958eba094dbde..0d0fe90fbb620 100755 --- a/llvm/utils/release/github-upload-release.py +++ b/llvm/utils/release/github-upload-release.py @@ -195,7 +195,7 @@ def upload_files(repo, release, files): def uncomment_download_links(repo, release_version): - release = repo.get_release("llvmorg-{}".format(release_version)) + release = repo.get_release(f"llvmorg-{release_version}") # At this point any automatic builds have finished and if # they succeeded, uploaded files to the release assets. From 2e738a717295cabda9e55f656914480fd3df5336 Mon Sep 17 00:00:00 2001 From: David Spickett Date: Thu, 20 Nov 2025 13:47:21 +0000 Subject: [PATCH 06/11] early continue to reduce indentation --- llvm/utils/release/github-upload-release.py | 43 ++++++++++++--------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/llvm/utils/release/github-upload-release.py b/llvm/utils/release/github-upload-release.py index 0d0fe90fbb620..b34b94010119f 100755 --- a/llvm/utils/release/github-upload-release.py +++ b/llvm/utils/release/github-upload-release.py @@ -207,25 +207,30 @@ def uncomment_download_links(repo, release_version): for line in release.body.splitlines(): # All hidden download links are of the form: # - if line.startswith("", "" - ).strip() - modified = True - else: - print( - " These files are not present:", - files.difference(release_assets), - ) - print(" Link line will remain hidden.") + if not line.startswith("", "" + ).strip() + modified = True + else: + print( + " These files are not present:", + files.difference(release_assets), + ) + print(" Link line will remain hidden.") new_message.append(line) From 4b9ee14074acad88f6c3f1b4507048026636d9f0 Mon Sep 17 00:00:00 2001 From: David Spickett Date: Thu, 20 Nov 2025 13:48:33 +0000 Subject: [PATCH 07/11] revise message --- llvm/utils/release/github-upload-release.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llvm/utils/release/github-upload-release.py b/llvm/utils/release/github-upload-release.py index b34b94010119f..6bc622b793e1c 100755 --- a/llvm/utils/release/github-upload-release.py +++ b/llvm/utils/release/github-upload-release.py @@ -148,7 +148,7 @@ def create_release(repo, release, tag=None, name=None, message=None): ## LLVM {release} Release {download_links} -Download links for common platforms will appear above, if they are available. Check the full list of release packages at the bottom of this release page if you do not find a link above. +Download links for common platforms will appear above once builds have completed, if they are available. Check the full list of release packages at the bottom of this release page if you do not find a link above. If you do not find a release package for your platform, you may be able to find a community built package on the LLVM Discourse forum thread for this release. Remember that these are built by volunteers and may not always be available. If you rely on a platform or configuration that is not one of the defaults, we suggest you use the binaries that your platform provides, or build your own release packages. From 51f3bf8cc2a6fa79594e94267fccb12d04112bc5 Mon Sep 17 00:00:00 2001 From: David Spickett Date: Thu, 20 Nov 2025 13:56:41 +0000 Subject: [PATCH 08/11] fix --- llvm/utils/release/github-upload-release.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llvm/utils/release/github-upload-release.py b/llvm/utils/release/github-upload-release.py index 6bc622b793e1c..8d50252571b0d 100755 --- a/llvm/utils/release/github-upload-release.py +++ b/llvm/utils/release/github-upload-release.py @@ -221,7 +221,7 @@ def uncomment_download_links(repo, release_version): print(" Files required:", files) if files.issubset(release_assets): print(" All files present, revealing link line.") - line.replace("", "" ).strip() modified = True From 7d57b8a48822788fe1fd3225d01dd4740e467270 Mon Sep 17 00:00:00 2001 From: David Spickett Date: Thu, 20 Nov 2025 14:00:06 +0000 Subject: [PATCH 09/11] files as a list --- llvm/utils/release/github-upload-release.py | 38 ++++++++++----------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/llvm/utils/release/github-upload-release.py b/llvm/utils/release/github-upload-release.py index 8d50252571b0d..0bdba37cbce45 100755 --- a/llvm/utils/release/github-upload-release.py +++ b/llvm/utils/release/github-upload-release.py @@ -39,7 +39,7 @@ # * A unique tag to go in "", "" - ).strip() + line = ( + line.replace("", "") + .strip() + ) modified = True else: print( From 5d6ba9b5cd6f311c1a9bd8ff453195aa6346badb Mon Sep 17 00:00:00 2001 From: David Spickett Date: Thu, 20 Nov 2025 14:06:17 +0000 Subject: [PATCH 11/11] tuple for files --- llvm/utils/release/github-upload-release.py | 30 ++++++++++----------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/llvm/utils/release/github-upload-release.py b/llvm/utils/release/github-upload-release.py index 3c0f806b7de67..76c1d6162405a 100755 --- a/llvm/utils/release/github-upload-release.py +++ b/llvm/utils/release/github-upload-release.py @@ -53,71 +53,71 @@ ( "LINUX_X86", "* [Linux x86_64]({0}) ([signature]({1}))", - [ + ( "LLVM-{release}-Linux-X64.tar.xz", "LLVM-{release}-Linux-X64.tar.xz.jsonl", - ], + ), ), ( "LINUX_ARM64", "* [Linux Arm64]({0}) ([signature]({1}))", - [ + ( "LLVM-{release}-Linux-ARM64.tar.xz", "LLVM-{release}-Linux-ARM64.tar.xz.jsonl", - ], + ), ), ( "LINUX_ARMV7A", "* [Linux Armv7-a]({0}) ([signature]({1}))", - [ + ( "clang+llvm-{release}-armv7a-linux-gnueabihf.tar.gz", "clang+llvm-{release}-armv7a-linux-gnueabihf.tar.gz.sig", - ], + ), ), ), ( ( "MACOS_ARM64", "* [macOS Apple Silicon]({0}) (ARM64) ([signature]({1}))", - [ + ( "LLVM-{release}-macOS-ARM64.tar.xz", "LLVM-{release}-macOS-ARM64.tar.xz.jsonl", - ], + ), ), ( "MACOS_X86", "* [macOS Intel]({0}) (x86-64) ([signature]({1}))", - [ + ( "LLVM-{release}-macOS-X64.tar.xz", "LLVM-{release}-macOS-X64.tar.xz.jsonl", - ], + ), ), ), ( ( "WINDOWS_X64", "* Windows x64 (64-bit): [installer]({0}) ([signature]({1})), [archive]({2}) ([signature]({3}))", - [ + ( "LLVM-{release}-win64.exe", "LLVM-{release}-win64.exe.sig", "clang+llvm-{release}-x86_64-pc-windows-msvc.tar.xz", "clang+llvm-{release}-x86_64-pc-windows-msvc.tar.xz.sig", - ], + ), ), ( "WINDOWS_X86", "* Windows x86 (32-bit): [installer]({0}) ([signature]({1}))", - ["LLVM-{release}-win32.exe", "LLVM-{release}-win32.exe.sig"], + ("LLVM-{release}-win32.exe", "LLVM-{release}-win32.exe.sig"), ), ( "WINDOWS_ARM64", "* Windows on Arm (ARM64): [installer]({0}) ([signature]({1})), [archive]({2}) ([signature]({3}))", - [ + ( "LLVM-{release}-woa64.exe", "LLVM-{release}-woa64.exe.sig", "clang+llvm-{release}-aarch64-pc-windows-msvc.tar.xz", "clang+llvm-{release}-aarch64-pc-windows-msvc.tar.xz.sig", - ], + ), ), ), )