Skip to content

Commit 58b89c8

Browse files
committed
[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.
1 parent d4516c7 commit 58b89c8

File tree

2 files changed

+75
-2
lines changed

2 files changed

+75
-2
lines changed

.github/workflows/release-tasks.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,3 +111,31 @@ jobs:
111111
# Called workflows don't have access to secrets by default, so we need to explicitly pass secrets that we use.
112112
secrets:
113113
RELEASE_TASKS_USER_TOKEN: ${{ secrets.RELEASE_TASKS_USER_TOKEN }}
114+
115+
uncomment-download-links:
116+
name: Uncomment download links
117+
runs-on: ubuntu-24.04
118+
permissions:
119+
contents: write # For updating the release message.
120+
needs:
121+
- validate-tag
122+
- release-create
123+
- release-binaries
124+
125+
steps:
126+
- name: Install Dependencies
127+
run: |
128+
sudo apt-get update
129+
sudo apt-get install python3-github
130+
131+
- name: Checkout LLVM
132+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
133+
with:
134+
sparse-checkout: llvm/utils/release/github-upload-release.py
135+
sparse-checkout-cone-mode: false
136+
137+
- name: Uncomment Download Links
138+
env:
139+
GITHUB_TOKEN: ${{ github.token }}
140+
run: |
141+
./llvm/utils/release/./github-upload-release.py --token "$GITHUB_TOKEN" --release ${{ needs.validate-tag.outputs.release-version }} uncomment_download_links

llvm/utils/release/github-upload-release.py

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,26 @@ def create_release(repo, release, tag=None, name=None, message=None):
4545
# Note that these lines are not length limited because if we do so, GitHub
4646
# assumes that should be how it is laid out on the page. We want GitHub to
4747
# do the reflowing for us instead.
48+
#
49+
# Once all the atuomatic binary builds have completed, the HTML comments
50+
# in the text below will be removed to reveal the download links.
4851
message = dedent(
4952
"""\
50-
LLVM {release} Release
53+
## LLVM {release} Release
54+
55+
<!-- DOWNLOAD_LINKS_BEGIN
56+
**Linux:**
57+
* [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))
58+
* [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))
59+
60+
**macOS:**
61+
* [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))
62+
* [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))
63+
DOWNLOAD_LINKS_END -->
64+
65+
Download links for Linux and macOS will appear here when all the builds have completed. <!-- DOWNLOAD_LINKS_PLACEHOLDER -->
66+
67+
For Windows, and any other variants of platform and architecture, check the full list of release packages at the bottom of this release page.
5168
5269
## Package Types
5370
@@ -95,9 +112,35 @@ def upload_files(repo, release, files):
95112
print("Done")
96113

97114

115+
def uncomment_download_links(repo, release):
116+
release = repo.get_release("llvmorg-{}".format(release))
117+
118+
new_message = []
119+
to_remove = [
120+
"DOWNLOAD_LINKS_BEGIN",
121+
"DOWNLOAD_LINKS_END",
122+
"DOWNLOAD_LINKS_PLACEHOLDER",
123+
]
124+
for line in release.body.splitlines():
125+
for comment in to_remove:
126+
if comment in line:
127+
break
128+
else:
129+
new_message.append(line)
130+
131+
release.update_release(
132+
name=release.title,
133+
message="\n".join(new_message),
134+
draft=release.draft,
135+
prerelease=release.prerelease,
136+
)
137+
138+
98139
parser = argparse.ArgumentParser()
99140
parser.add_argument(
100-
"command", type=str, choices=["create", "upload", "check-permissions"]
141+
"command",
142+
type=str,
143+
choices=["create", "upload", "check-permissions", "uncomment_download_links"],
101144
)
102145

103146
# All args
@@ -137,3 +180,5 @@ def upload_files(repo, release, files):
137180
create_release(llvm_repo, args.release)
138181
if args.command == "upload":
139182
upload_files(llvm_repo, args.release, args.files)
183+
if args.command == "uncomment_download_links":
184+
uncomment_download_links(llvm_repo, args.release)

0 commit comments

Comments
 (0)