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 e9591b00e2b5a..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 @@ -75,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 +$ gh attestation verify --repo llvm/llvm-project (if you are able to connect to GitHub) -gh attestation verify --repo llvm/llvm-project --bundle .jsonl +$ gh attestation verify --repo llvm/llvm-project --bundle .jsonl (using attestation file on disk) ```""" ).format(release=release) @@ -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)