[llvm] [llvm][release] Add links to automatically built packages (PR #147719)

David Spickett via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 11 05:02:24 PDT 2025


https://github.com/DavidSpickett updated https://github.com/llvm/llvm-project/pull/147719

>From 3cc21448b7a31cab999ec48e479f6187692e7245 Mon Sep 17 00:00:00 2001
From: David Spickett <david.spickett at linaro.org>
Date: Fri, 4 Jul 2025 08:54:32 +0000
Subject: [PATCH 01/12] [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         | 26 ++++++++++++
 llvm/utils/release/github-upload-release.py | 44 ++++++++++++++++++++-
 2 files changed, 69 insertions(+), 1 deletion(-)

diff --git a/.github/workflows/release-tasks.yml b/.github/workflows/release-tasks.yml
index d55098345d89e..98e3f48391fa6 100644
--- a/.github/workflows/release-tasks.yml
+++ b/.github/workflows/release-tasks.yml
@@ -111,3 +111,29 @@ 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 at b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
+
+      - name: Uncomment Download Links
+        env:
+          GITHUB_TOKEN: ${{ github.token }}
+          USER_TOKEN: ${{ secrets.RELEASE_TASKS_USER_TOKEN }}
+        run: |
+          ./llvm/utils/release/./github-upload-release.py --token "$GITHUB_TOKEN" --release ${{ needs.validate-tag.outputs.release-version }} --user ${{ github.actor }} --user-token "$USER_TOKEN" uncomment_download_links
diff --git a/llvm/utils/release/github-upload-release.py b/llvm/utils/release/github-upload-release.py
index e9591b00e2b5a..f73b9927c9da9 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 binaries are built, the HTML comments in the text below will be
+        # used to swap the placeholder text with the now valid download links.
         message = dedent(
             """\
-LLVM {release} Release
+## LLVM {release} Release
+
+<!-- DOWNLOAD_LINKS_BEGIN
+**Linux:**
+* [x86_64](https://github.com/llvm/llvm-project/releases/download/llvmorg-{release}/LLVM-{release}-Linux-X64.tar.xz) ([signature](https://github.com/llvm/llvm-project/releases/download/llvmorg-{release}/LLVM-{release}-Linux-X64.tar.xz.jsonl))
+* [Arm64](https://github.com/llvm/llvm-project/releases/download/llvmorg-{release}/LLVM-{release}-Linux-ARM64.tar.xz) ([signature](https://github.com/llvm/llvm-project/releases/download/llvmorg-{release}/LLVM-{release}-Linux-ARM64.tar.xz.jsonl))
+
+**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 above once builds complete. <!-- DOWNLOAD_LINKS_PLACEHOLDER -->
+
+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,6 +112,29 @@ 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.message.splitlines():
+        for comment in to_remove:
+            if comment in line:
+                continue
+        new_message.append(line)
+
+    release.update_release(
+        name=release.name,
+        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"]
@@ -137,3 +177,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.commands == "uncomment_download_links":
+    uncomment_download_links(llvm_repo, args.release)

>From 706738c81999f2b8bd1d1a87e9c120bf97eefcfa Mon Sep 17 00:00:00 2001
From: David Spickett <david.spickett at linaro.org>
Date: Wed, 9 Jul 2025 13:21:06 +0000
Subject: [PATCH 02/12] sparse checkout script

---
 .github/workflows/release-tasks.yml | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/.github/workflows/release-tasks.yml b/.github/workflows/release-tasks.yml
index 98e3f48391fa6..6228ec887b61f 100644
--- a/.github/workflows/release-tasks.yml
+++ b/.github/workflows/release-tasks.yml
@@ -130,6 +130,9 @@ jobs:
 
       - name: Checkout LLVM
         uses: actions/checkout at b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
+        with:
+          sparse-checkout: llvm/utils/release/github-upload-release.py
+          sparse-checkout-cone-mode: false
 
       - name: Uncomment Download Links
         env:

>From ee5f5837ef7c697f31189a7a8818ee84640d5920 Mon Sep 17 00:00:00 2001
From: David Spickett <david.spickett at linaro.org>
Date: Wed, 9 Jul 2025 13:35:08 +0000
Subject: [PATCH 03/12] reword

---
 llvm/utils/release/github-upload-release.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/llvm/utils/release/github-upload-release.py b/llvm/utils/release/github-upload-release.py
index f73b9927c9da9..c3fbecf0b4f5d 100755
--- a/llvm/utils/release/github-upload-release.py
+++ b/llvm/utils/release/github-upload-release.py
@@ -46,8 +46,8 @@ def create_release(repo, release, tag=None, name=None, message=None):
         # assumes that should be how it is laid out on the page. We want GitHub to
         # do the reflowing for us instead.
         #
-        # Once all binaries are built, the HTML comments in the text below will be
-        # used to swap the placeholder text with the now valid download links.
+        # 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

>From f846a35c98b23866a9a5f135f056dd583a4fecb5 Mon Sep 17 00:00:00 2001
From: David Spickett <david.spickett at linaro.org>
Date: Wed, 9 Jul 2025 13:36:15 +0000
Subject: [PATCH 04/12] correct placeholder

---
 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 c3fbecf0b4f5d..880c1be87cf91 100755
--- a/llvm/utils/release/github-upload-release.py
+++ b/llvm/utils/release/github-upload-release.py
@@ -62,7 +62,7 @@ def create_release(repo, release, tag=None, name=None, message=None):
 * [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 above once builds complete. <!-- DOWNLOAD_LINKS_PLACEHOLDER -->
+Download links for Linux and macOS will appear here once builds complete. <!-- DOWNLOAD_LINKS_PLACEHOLDER -->
 
 For Windows, and any other variants of platform and architecture, check the full list of release packages at the bottom of this release page.
 

>From 8db2b7615355a82d10a2413c646160302e62de5b Mon Sep 17 00:00:00 2001
From: David Spickett <david.spickett at linaro.org>
Date: Wed, 9 Jul 2025 13:37:09 +0000
Subject: [PATCH 05/12] reword more

---
 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 880c1be87cf91..8e66adc71eda5 100755
--- a/llvm/utils/release/github-upload-release.py
+++ b/llvm/utils/release/github-upload-release.py
@@ -62,7 +62,7 @@ def create_release(repo, release, tag=None, name=None, message=None):
 * [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 once builds complete. <!-- DOWNLOAD_LINKS_PLACEHOLDER -->
+Download links for Linux and macOS will appear here when all the builds have completed. <!-- DOWNLOAD_LINKS_PLACEHOLDER -->
 
 For Windows, and any other variants of platform and architecture, check the full list of release packages at the bottom of this release page.
 

>From 453534ca2db90d020e968116834d024585cb4665 Mon Sep 17 00:00:00 2001
From: David Spickett <david.spickett at linaro.org>
Date: Fri, 11 Jul 2025 09:55:51 +0000
Subject: [PATCH 06/12] correct command

---
 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 8e66adc71eda5..0189a97014c97 100755
--- a/llvm/utils/release/github-upload-release.py
+++ b/llvm/utils/release/github-upload-release.py
@@ -177,5 +177,5 @@ def uncomment_download_links(repo, release):
     create_release(llvm_repo, args.release)
 if args.command == "upload":
     upload_files(llvm_repo, args.release, args.files)
-if args.commands == "uncomment_download_links":
+if args.command == "uncomment_download_links":
     uncomment_download_links(llvm_repo, args.release)

>From b9ed6ffa9c6c0b9ec523cac3edd8a215788e54d3 Mon Sep 17 00:00:00 2001
From: David Spickett <david.spickett at linaro.org>
Date: Fri, 11 Jul 2025 10:17:12 +0000
Subject: [PATCH 07/12] script fixes

---
 llvm/utils/release/github-upload-release.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/llvm/utils/release/github-upload-release.py b/llvm/utils/release/github-upload-release.py
index 0189a97014c97..a94f00725c4fe 100755
--- a/llvm/utils/release/github-upload-release.py
+++ b/llvm/utils/release/github-upload-release.py
@@ -124,8 +124,9 @@ def uncomment_download_links(repo, release):
     for line in release.message.splitlines():
         for comment in to_remove:
             if comment in line:
-                continue
-        new_message.append(line)
+                break
+        else:
+            new_message.append(line)
 
     release.update_release(
         name=release.name,
@@ -137,7 +138,9 @@ def uncomment_download_links(repo, release):
 
 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

>From d42a84f893e19bd64275d16742630ea9352eab9a Mon Sep 17 00:00:00 2001
From: David Spickett <david.spickett at linaro.org>
Date: Fri, 11 Jul 2025 10:26:32 +0000
Subject: [PATCH 08/12] format

---
 llvm/utils/release/github-upload-release.py | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/llvm/utils/release/github-upload-release.py b/llvm/utils/release/github-upload-release.py
index a94f00725c4fe..c766932abbe92 100755
--- a/llvm/utils/release/github-upload-release.py
+++ b/llvm/utils/release/github-upload-release.py
@@ -138,9 +138,7 @@ def uncomment_download_links(repo, release):
 
 parser = argparse.ArgumentParser()
 parser.add_argument(
-    "command",
-    type=str,
-    choices=["create", "upload", "check-permissions", "uncomment_download_links"],
+    "command", type=str, choices=["create", "upload", "check-permissions", "uncomment_download_links"]
 )
 
 # All args

>From b6033489bffd4dbf2fbd9d7d02a4714d7b5fa695 Mon Sep 17 00:00:00 2001
From: David Spickett <david.spickett at linaro.org>
Date: Fri, 11 Jul 2025 10:26:41 +0000
Subject: [PATCH 09/12] mark commands

---
 llvm/utils/release/github-upload-release.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/llvm/utils/release/github-upload-release.py b/llvm/utils/release/github-upload-release.py
index c766932abbe92..7941b35c18ec3 100755
--- a/llvm/utils/release/github-upload-release.py
+++ b/llvm/utils/release/github-upload-release.py
@@ -92,9 +92,9 @@ def create_release(repo, release, tag=None, name=None, message=None):
 
 If it has a `.jsonl` file, use [gh](https://cli.github.com/manual/gh_attestation_verify) to verify the package:
 ```
-gh attestation verify --repo llvm/llvm-project <package file name>
+$ gh attestation verify --repo llvm/llvm-project <package file name>
 (if you are able to connect to GitHub)
-gh attestation verify --repo llvm/llvm-project <package file name> --bundle <package file name>.jsonl
+$ gh attestation verify --repo llvm/llvm-project <package file name> --bundle <package file name>.jsonl
 (using attestation file on disk)
 ```"""
         ).format(release=release)

>From 5c4c5ae585de4d801e75cd188625808fa9c8e5f8 Mon Sep 17 00:00:00 2001
From: David Spickett <david.spickett at linaro.org>
Date: Fri, 11 Jul 2025 11:56:46 +0000
Subject: [PATCH 10/12] testing fixes

---
 .github/workflows/release-tasks.yml         | 3 +--
 llvm/utils/release/github-upload-release.py | 4 ++--
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/.github/workflows/release-tasks.yml b/.github/workflows/release-tasks.yml
index 6228ec887b61f..c9ae7e1ce97c3 100644
--- a/.github/workflows/release-tasks.yml
+++ b/.github/workflows/release-tasks.yml
@@ -137,6 +137,5 @@ jobs:
       - name: Uncomment Download Links
         env:
           GITHUB_TOKEN: ${{ github.token }}
-          USER_TOKEN: ${{ secrets.RELEASE_TASKS_USER_TOKEN }}
         run: |
-          ./llvm/utils/release/./github-upload-release.py --token "$GITHUB_TOKEN" --release ${{ needs.validate-tag.outputs.release-version }} --user ${{ github.actor }} --user-token "$USER_TOKEN" uncomment_download_links
+          ./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 7941b35c18ec3..055166e6911c4 100755
--- a/llvm/utils/release/github-upload-release.py
+++ b/llvm/utils/release/github-upload-release.py
@@ -121,7 +121,7 @@ def uncomment_download_links(repo, release):
         "DOWNLOAD_LINKS_END",
         "DOWNLOAD_LINKS_PLACEHOLDER",
     ]
-    for line in release.message.splitlines():
+    for line in release.body.splitlines():
         for comment in to_remove:
             if comment in line:
                 break
@@ -129,7 +129,7 @@ def uncomment_download_links(repo, release):
             new_message.append(line)
 
     release.update_release(
-        name=release.name,
+        name=release.title,
         message="\n".join(new_message),
         draft=release.draft,
         prerelease=release.prerelease,

>From 50bde714aaadd2d15e47b4f4e12b40f6343cd57a Mon Sep 17 00:00:00 2001
From: David Spickett <david.spickett at linaro.org>
Date: Fri, 11 Jul 2025 11:58:01 +0000
Subject: [PATCH 11/12] format

---
 llvm/utils/release/github-upload-release.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/llvm/utils/release/github-upload-release.py b/llvm/utils/release/github-upload-release.py
index 055166e6911c4..783234cc22c7c 100755
--- a/llvm/utils/release/github-upload-release.py
+++ b/llvm/utils/release/github-upload-release.py
@@ -138,7 +138,9 @@ def uncomment_download_links(repo, release):
 
 parser = argparse.ArgumentParser()
 parser.add_argument(
-    "command", type=str, choices=["create", "upload", "check-permissions", "uncomment_download_links"]
+    "command",
+    type=str,
+    choices=["create", "upload", "check-permissions", "uncomment_download_links"]
 )
 
 # All args

>From 451e71b2972ca86ad74ad8a119ea11010d03536d Mon Sep 17 00:00:00 2001
From: David Spickett <david.spickett at linaro.org>
Date: Fri, 11 Jul 2025 12:02:01 +0000
Subject: [PATCH 12/12] format again

---
 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 783234cc22c7c..e90921d790eeb 100755
--- a/llvm/utils/release/github-upload-release.py
+++ b/llvm/utils/release/github-upload-release.py
@@ -140,7 +140,7 @@ def uncomment_download_links(repo, release):
 parser.add_argument(
     "command",
     type=str,
-    choices=["create", "upload", "check-permissions", "uncomment_download_links"]
+    choices=["create", "upload", "check-permissions", "uncomment_download_links"],
 )
 
 # All args



More information about the llvm-commits mailing list