From 58b89c8ac2edee8f68018298421598aa8667f801 Mon Sep 17 00:00:00 2001 From: David Spickett Date: Fri, 4 Jul 2025 08:54:32 +0000 Subject: [PATCH 1/4] [llvm][release] Add links to automatically built packages on release page This adds links to the release packages that are automatically built using GitHub, so that users of those platforms can find them more easily. The approach taken: * "LLVM x.y.z Release" becomes the title for this links section. * No hand built files are linked to because we can't be sure when or if they will appear. It's better that users check the full file list if they need those. * This means no Windows links, but I've specifically mentioned Windows just below the links to mitigate this. * I have tried to use the vendor names for the architectures, that casual users would recognise. * Their signature file is linked as well. I expect most will ignore this but better to show it to remind people it exists. * I called it "signature" as a generic term to cover the .jsonl and .sig files, but we're not linking to any .sig files yet. * Links are initially commented out and there is a placeholder string. Once all binaries are built, the placeholder is removed and the download links revelealed (we wait for them all so we don't have many jobs racing to update the release text). I considered generating this using a lot of templates, but considering the small number of links and how useful it is to see the layout in the Python file, I prefer writing it out. --- .github/workflows/release-tasks.yml | 28 ++++++++++++ llvm/utils/release/github-upload-release.py | 49 ++++++++++++++++++++- 2 files changed, 75 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release-tasks.yml b/.github/workflows/release-tasks.yml index d55098345d89e..c9ae7e1ce97c3 100644 --- a/.github/workflows/release-tasks.yml +++ b/.github/workflows/release-tasks.yml @@ -111,3 +111,31 @@ jobs: # Called workflows don't have access to secrets by default, so we need to explicitly pass secrets that we use. secrets: RELEASE_TASKS_USER_TOKEN: ${{ secrets.RELEASE_TASKS_USER_TOKEN }} + + uncomment-download-links: + name: Uncomment download links + runs-on: ubuntu-24.04 + permissions: + contents: write # For updating the release message. + needs: + - validate-tag + - release-create + - release-binaries + + steps: + - name: Install Dependencies + run: | + sudo apt-get update + sudo apt-get install python3-github + + - name: Checkout LLVM + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + sparse-checkout: llvm/utils/release/github-upload-release.py + sparse-checkout-cone-mode: false + + - name: Uncomment Download Links + env: + GITHUB_TOKEN: ${{ github.token }} + run: | + ./llvm/utils/release/./github-upload-release.py --token "$GITHUB_TOKEN" --release ${{ needs.validate-tag.outputs.release-version }} uncomment_download_links diff --git a/llvm/utils/release/github-upload-release.py b/llvm/utils/release/github-upload-release.py index 90c222d1175c7..e90921d790eeb 100755 --- a/llvm/utils/release/github-upload-release.py +++ b/llvm/utils/release/github-upload-release.py @@ -45,9 +45,26 @@ 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 + # in the text below will be removed to reveal the download links. message = dedent( """\ -LLVM {release} Release +## LLVM {release} Release + + + +Download links for Linux and macOS will appear here when all the builds have completed. + +For Windows, and any other variants of platform and architecture, check the full list of release packages at the bottom of this release page. ## Package Types @@ -95,9 +112,35 @@ def upload_files(repo, release, files): print("Done") +def uncomment_download_links(repo, release): + release = repo.get_release("llvmorg-{}".format(release)) + + new_message = [] + to_remove = [ + "DOWNLOAD_LINKS_BEGIN", + "DOWNLOAD_LINKS_END", + "DOWNLOAD_LINKS_PLACEHOLDER", + ] + 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, + ) + + parser = argparse.ArgumentParser() parser.add_argument( - "command", type=str, choices=["create", "upload", "check-permissions"] + "command", + type=str, + choices=["create", "upload", "check-permissions", "uncomment_download_links"], ) # All args @@ -137,3 +180,5 @@ def upload_files(repo, release, files): create_release(llvm_repo, args.release) if args.command == "upload": upload_files(llvm_repo, args.release, args.files) +if args.command == "uncomment_download_links": + uncomment_download_links(llvm_repo, args.release) From 5b09a3ba51fcb326b7c77d4a7a69cf696ee2f5fd Mon Sep 17 00:00:00 2001 From: David Spickett Date: Fri, 18 Jul 2025 09:17:19 +0000 Subject: [PATCH 2/4] Add links for other builds, to be manually uncommented. --- llvm/utils/release/github-upload-release.py | 35 ++++++++++++--------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/llvm/utils/release/github-upload-release.py b/llvm/utils/release/github-upload-release.py index e90921d790eeb..bd62aaa1bca41 100755 --- a/llvm/utils/release/github-upload-release.py +++ b/llvm/utils/release/github-upload-release.py @@ -47,24 +47,31 @@ def create_release(repo, release, tag=None, name=None, message=None): # do the reflowing for us instead. # # Once all the atuomatic binary builds have completed, the HTML comments - # in the text below will be removed to reveal the download links. + # 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. message = dedent( """\ ## LLVM {release} Release - + -**macOS:** -* [Apple Silicon](https://github.com/llvm/llvm-project/releases/download/llvmorg-{release}/LLVM-{release}-macOS-ARM64.tar.xz) (ARM64) ([signature](https://github.com/llvm/llvm-project/releases/download/llvmorg-{release}/LLVM-{release}-macOS-ARM64.tar.xz.jsonl)) -* [Intel](https://github.com/llvm/llvm-project/releases/download/llvmorg-{release}/LLVM-{release}-macOS-X64.tar.xz) (x86-64) ([signature](https://github.com/llvm/llvm-project/releases/download/llvmorg-{release}/LLVM-{release}-macOS-X64.tar.xz.jsonl)) -DOWNLOAD_LINKS_END --> + -Download links for Linux and macOS will appear here when all the builds have completed. + + + -For Windows, and any other variants of platform and architecture, check the full list of release packages at the bottom of this release page. +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. ## Package Types @@ -117,9 +124,9 @@ def uncomment_download_links(repo, release): new_message = [] to_remove = [ - "DOWNLOAD_LINKS_BEGIN", - "DOWNLOAD_LINKS_END", - "DOWNLOAD_LINKS_PLACEHOLDER", + "AUTOMATIC_DOWNLOAD_LINKS_BEGIN", + "AUTOMATIC_DOWNLOAD_LINKS_END", + "AUTOMATIC_DOWNLOAD_LINKS_PLACEHOLDER", ] for line in release.body.splitlines(): for comment in to_remove: From 7b448639a3625d95c454b310a7254986f94b63d1 Mon Sep 17 00:00:00 2001 From: David Spickett Date: Fri, 18 Jul 2025 09:35:44 +0000 Subject: [PATCH 3/4] move the forum mention further up --- llvm/utils/release/github-upload-release.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/llvm/utils/release/github-upload-release.py b/llvm/utils/release/github-upload-release.py index bd62aaa1bca41..bd6157422502a 100755 --- a/llvm/utils/release/github-upload-release.py +++ b/llvm/utils/release/github-upload-release.py @@ -71,7 +71,7 @@ def create_release(repo, release, tag=None, name=None, message=None): 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. +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. ## Package Types @@ -79,10 +79,6 @@ def create_release(repo, release, tag=None, name=None, message=None): Except for Windows. Where `LLVM-*.exe` is an installer intended for using LLVM as a toolchain and `clang+llvm-` contains the contents of the installer, plus libraries and tools not normally used in a toolchain. You most likely want the `LLVM-` installer, unless you are developing software which itself uses LLVM, in which case choose `clang+llvm-`. -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. - In addition, source archives are available: * `-{release}.src.tar.xz` are archives of the sources of specific sub-projects of `llvm-project` (except for `test-suite` which is an archive of the [LLVM Test Suite](https://github.com/llvm/llvm-test-suite)). * To get all the `llvm-project` source code for this release, choose `llvm-project-{release}.src.tar.xz`. From 5b38120d4d27779f1e88371c4adf10846d4728c4 Mon Sep 17 00:00:00 2001 From: David Spickett Date: Fri, 18 Jul 2025 09:47:33 +0000 Subject: [PATCH 4/4] Repeat the "archive" term in package types explanation --- 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 bd6157422502a..5ed037ee9522a 100755 --- a/llvm/utils/release/github-upload-release.py +++ b/llvm/utils/release/github-upload-release.py @@ -77,7 +77,7 @@ def create_release(repo, release, tag=None, name=None, message=None): Each platform has one binary release package. The file name starts with either `LLVM-` or `clang+llvm-` and ends with the platform's name. For example, `LLVM-{release}-Linux-ARM64.tar.xz` contains LLVM binaries for Arm64 Linux. -Except for Windows. Where `LLVM-*.exe` is an installer intended for using LLVM as a toolchain and `clang+llvm-` contains the contents of the installer, plus libraries and tools not normally used in a toolchain. You most likely want the `LLVM-` installer, unless you are developing software which itself uses LLVM, in which case choose `clang+llvm-`. +Except for Windows. Where `LLVM-*.exe` is an installer intended for using LLVM as a toolchain and the archive `clang+llvm-` contains the contents of the installer, plus libraries and tools not normally used in a toolchain. You most likely want the `LLVM-` installer, unless you are developing software which itself uses LLVM, in which case choose `clang+llvm-`. In addition, source archives are available: * `-{release}.src.tar.xz` are archives of the sources of specific sub-projects of `llvm-project` (except for `test-suite` which is an archive of the [LLVM Test Suite](https://github.com/llvm/llvm-test-suite)).