diff --git a/.github/workflows/release-tasks.yml b/.github/workflows/release-tasks.yml index d4c2a55fcc9d7..0ce3fe903e627 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: '!cancelled()' needs: - - validate-tag - - release-create - release-binaries steps: diff --git a/llvm/utils/release/github-upload-release.py b/llvm/utils/release/github-upload-release.py index d58bb544e17dd..76c1d6162405a 100755 --- a/llvm/utils/release/github-upload-release.py +++ b/llvm/utils/release/github-upload-release.py @@ -34,6 +34,116 @@ from textwrap import dedent +# This is a tuple of sections of download links. Each section then contains +# an entry for each line in that section. Each line entry contains: +# * A unique tag to go in "" + 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 +155,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 will appear here once builds have completed. +{download_links} +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. -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 +192,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 +207,56 @@ 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(f"llvmorg-{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: + # All hidden download links are of the form: + # + 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) + + if modified: + release.update_release( + name=release.title, + message="\n".join(new_message), + draft=release.draft, + prerelease=release.prerelease, + ) parser = argparse.ArgumentParser()