From 6edc43be7e52d9f44bc842a9956bd40213b972b1 Mon Sep 17 00:00:00 2001 From: sputt Date: Mon, 30 Sep 2024 12:25:48 -0700 Subject: [PATCH] Fix release notes template tag. (#393) The existing release notes template block can't be pasted into a MODULE.bazel because it generates an invalid semver. Strip the leading "v". --- .github/workflows/release_notes_template.txt | 19 ++++++++++--------- .github/workflows/release_prep.sh | 2 ++ 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/.github/workflows/release_notes_template.txt b/.github/workflows/release_notes_template.txt index e0efd9a2..281e527a 100644 --- a/.github/workflows/release_notes_template.txt +++ b/.github/workflows/release_notes_template.txt @@ -3,15 +3,7 @@ Minimum bazel version: **7.0.0** If you're using `bzlmod`, add the following to `MODULE.bazel`: ```starlark -bazel_dep(name = "toolchains_llvm", version = "{tag}") - -# To directly use a commit from GitHub, replace commit with the commit you want. -# Otherwise, omit this block. -git_override( - module_name = "toolchains_llvm", - commit = "{commit}", - remote = "https://github.com/bazel-contrib/toolchains_llvm", -) +bazel_dep(name = "toolchains_llvm", version = "{version}") # Configure and register the toolchain. llvm = use_extension("@toolchains_llvm//toolchain/extensions:llvm.bzl", "llvm") @@ -25,6 +17,15 @@ use_repo(llvm, "llvm_toolchain") register_toolchains("@llvm_toolchain//:all") ``` +To directly use a commit from GitHub, add this block and replace commit with the commit you want. +```starlark +git_override( + module_name = "toolchains_llvm", + commit = "{commit}", + remote = "https://github.com/bazel-contrib/toolchains_llvm", +) +``` + If not using `bzlmod`, include this section in your `WORKSPACE`: ```starlark diff --git a/.github/workflows/release_prep.sh b/.github/workflows/release_prep.sh index a5afc2df..50482965 100755 --- a/.github/workflows/release_prep.sh +++ b/.github/workflows/release_prep.sh @@ -16,7 +16,9 @@ sed -i.bak "s/0.0.0/${tag}/" MODULE.bazel && git add MODULE.bazel && git commit git archive --format=tar --prefix="${prefix}/" HEAD | gzip >"${archive}" sha=$(shasum -a 256 "${archive}" | cut -f1 -d' ') +# Strip leading "v" from the tag if present to create the semver version. sed \ + -e "s/{version}/${tag#v}/g" \ -e "s/{tag}/${tag}/g" \ -e "s/{commit}/${commit}/g" \ -e "s/{prefix}/${prefix}/g" \