From 8545f3c784a913c1b0d9d06cdbb78db1083d80e8 Mon Sep 17 00:00:00 2001 From: Armando Navarro Date: Fri, 25 Sep 2026 12:21:12 -0700 Subject: [PATCH] fix(build): order canaries by commit time, keep all-digit hashes intact Canaries were named `-canary.`, so npm ranked them by hash: alphabetically, with all-digit hashes below the rest. Naming them `-canary..sha-` ranks them by age. The time comes from the commit, so the weekday scheduled rebuild of an unchanged main produces the same name. `npm version` drops the leading zero of an all-digit identifier, so a hash like 0123456 would publish as 123456. The `sha-` prefix keeps it text. Fixes #3771 --- tools/build.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/build.sh b/tools/build.sh index ad31edac0..13946716b 100755 --- a/tools/build.sh +++ b/tools/build.sh @@ -1,4 +1,3 @@ -SHORT_SHA=$(git rev-parse --short $GITHUB_SHA) TAG_TEST="^refs/tags/.+$" LATEST_TEST="^[^-]*$" @@ -18,7 +17,9 @@ else if [[ $BASE_VERSION != "$FULL_VERSION" ]]; then echo "package.json version is $FULL_VERSION. Naming this canary after $BASE_VERSION instead, so it does not outrank $FULL_VERSION on npm. Prereleases are published from their own git tag, so this field is meant to hold a plain release number." >&2 fi - OVERRIDE_VERSION=$BASE_VERSION-canary.$SHORT_SHA + # `sha-` stops npm dropping an all-digit sha's leading zero. + CANARY_ID=$(TZ=UTC git show -s --date=format-local:%Y%m%d%H%M%S --format=%cd.sha-%h $GITHUB_SHA) + OVERRIDE_VERSION=$BASE_VERSION-canary.$CANARY_ID NPM_TAG=canary fi;