From 5fd4e4870c92e86be5c2d94b41f623e81a5aa653 Mon Sep 17 00:00:00 2001 From: Pushkinist <4850452+Pushkinist@users.noreply.github.com> Date: Wed, 17 Jun 2026 11:50:06 +0700 Subject: [PATCH] fix(release): source_sha256.sh --write also bumps the formula url version Previously --write patched only the sha256, leaving the url at the old tag -> brew install sha mismatch (documented gotcha). Now it bumps the url tag version too, anchored to the 'url "...archive/refs/tags/' line so the instructional comment is untouched. Idempotent on an already-current formula. --- scripts/release/source_sha256.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/release/source_sha256.sh b/scripts/release/source_sha256.sh index a16b919..d0e23fc 100755 --- a/scripts/release/source_sha256.sh +++ b/scripts/release/source_sha256.sh @@ -32,7 +32,13 @@ SHA=$(curl -fsSL "$URL" | shasum -a 256 | awk '{print $1}') echo "sha256: $SHA" if [ "${1:-}" = "--write" ]; then + # Bump BOTH the url tag version AND the sha256. Patching only the sha leaves + # the formula pointing at the previous tag's tarball with the new tag's sha, + # so `brew install` fails on a sha mismatch. The url substitution is anchored + # to the ` url "...archive/refs/tags/` line so the instructional comment + # above (which mentions an older tag) is left untouched. + sed -i '' -E "s|^( url \"https://github.com/${OWNER_REPO}/archive/refs/tags/)v[^\"]*\.tar\.gz\"|\1v${VER}.tar.gz\"|" "$FORMULA" sed -i '' -E "s|^( sha256 )\"[^\"]*\"|\1\"$SHA\"|" "$FORMULA" - echo "==> patched $FORMULA" - grep -n "sha256" "$FORMULA" + echo "==> patched $FORMULA (url -> v${VER}, sha256)" + grep -nE 'archive/refs/tags|sha256 ' "$FORMULA" fi