diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 85ad09f6..0e7a1fe0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -118,18 +118,33 @@ jobs: # at 4.5.0 here. Asking each registry directly also makes a re-run heal it. - name: Which registries are behind package.json? id: lag + env: + CHANGESETS_PUBLISHED: ${{ steps.changesets.outputs.published }} run: | set -euo pipefail VERSION=$(node -p "require('./package.json').version") echo "Target version: ${VERSION}" - # npm is the source of truth for "this version is released". The + # Is ${VERSION} actually released? Two independent yeses, because + # neither alone is sufficient: + # + # - changesets published it in THIS run. Authoritative immediately, + # and necessary because npm reads are eventually consistent: a + # `npm view` moments after a successful publish still 404s, which + # skipped all four steps for 4.5.4 and left them a version behind. + # - npm already serves it. This is the backfill path — it lets a + # re-run catch up registries that an earlier run left behind. + # + # Neither true means package.json is bumped but unreleased. The # changesets action leaves the workspace on the version branch, so in a - # run that only OPENS the version PR, package.json is already bumped to - # a version nothing has published yet — without this gate the four - # steps below would ship it ahead of npm, from an unmerged branch. - if ! npm view "@smooai/logger@${VERSION}" version >/dev/null 2>&1; then - echo "npm does not have ${VERSION} yet — nothing to backfill." + # run that only OPENS the version PR this is exactly the case, and + # publishing here would ship ahead of npm from an unmerged branch. + if [ "${CHANGESETS_PUBLISHED:-false}" = "true" ]; then + echo "changesets published ${VERSION} in this run." + elif npm view "@smooai/logger@${VERSION}" version >/dev/null 2>&1; then + echo "npm already serves ${VERSION} — checking the others for backfill." + else + echo "${VERSION} is not released (not published here, not on npm) — nothing to do." { echo "pypi=no"; echo "crates=no"; echo "nuget=no"; echo "gotag=no" } >> "$GITHUB_OUTPUT"