fix: release_prep.sh tag source, archive name, and MODULE.bazel version patching#9
Merged
Merged
Conversation
…on patching - Read tag from $1 (positional arg from release_ruleset.yaml), not env var - Archive name includes 'v' prefix (bazel-contrib convention) - Patch MODULE.bazel version inside module() block in the archive (BCR compat) - Add tag format validation (semver regex guard) - Add release-prep-test.yaml regression test with path filters - Reproducible archives: gzip -n + GNU tar deterministic flags when available - Temp dir cleanup via EXIT trap - Graceful error on missing/invalid arguments
9f064ef to
492bac0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Fixes three bugs in
.github/workflows/release_prep.shthat caused the v0.2.0 release to produce a misnamed archive with a stale MODULE.bazel version.Bug 1: Tag source (root cause of
rules_odin-main.tar.gz)Before:
TAG="${TAG:-${GITHUB_REF_NAME:-}}"— reads from env var, whichrelease_ruleset.yamlnever sets. Falls back toGITHUB_REF_NAME=main(the branch).After:
TAG="${1:-}"— reads the positional argument thatrelease_ruleset.yamlactually passes:.github/workflows/release_prep.sh ${{ inputs.tag_name || github.ref_name }}Bug 2: Archive name missing
vprefixBefore:
rules_odin-0.2.0.tar.gzAfter:
rules_odin-v0.2.0.tar.gz— matches bazel-contrib convention and GitHub's source archive naming, so users can switch between released artifacts and source archives with identicalstrip_prefix.Bug 3: MODULE.bazel version lag
Problem:
smlx/ccvtags HEAD as-is.MODULE.bazelstill saysversion = "0.1.0"when the tag isv0.2.0. BCR validation requires exact match (FAILEDif not).Fix: Extract git archive to tmpdir,
sedpatchversioninsidemodule()block only (notbazel_depversions), verify the patch applied, re-archive.Additional hardening (from @change-validator review)
gzip -nstrips gzip timestamp; GNU tar flags (--sort=name --mtime=@0 --owner=0 --group=0 --numeric-owner) used when available (CI on Ubuntu). Falls back gracefully on macOS.sed -n '/^module(/,/^)/p' | grep -qverifies the version was actually patched insidemodule(), not just anywhere in the file.trap 'rm -rf "${TMPDIR}"' EXITensures cleanup on all exit paths.TAG="${1:-}"underset -o nounset— graceful error instead of crash when no arg provided.How was it tested?
.github/workflows/release_prep.sh v0.2.0locally:rules_odin-v0.2.0.tar.gz✅MODULE.bazelhasversion = "0.2.0"inmodule()✅bazel_depversions unchanged (1.7.1,0.0.10) ✅odin_version = "dev-2026-06"unchanged ✅version = "0.2.0"✅.github/workflows/release_prep.shwith no arg → graceful error ✅pre-commit run --all-files— all 10 hooks pass ✅bazel build //...— no regressions ✅@change-validator— APPROVE WITH CONCERNS (1 concern: grep scope → fixed)Checklist
check.yaml— lint + test matrix)