From 5d93277cdb580b8563985bd9ab18e9984de46b7f Mon Sep 17 00:00:00 2001 From: Brian Madison Date: Sun, 26 Apr 2026 10:12:58 -0500 Subject: [PATCH] fix(publish): advance @next dist-tag after stable release When a stable release publishes via workflow_dispatch, @latest can leapfrog the existing @next prerelease (e.g. latest=6.5.0 while next=6.4.1-next.0), turning `npx bmad-method@next install` into a silent downgrade until the next qualifying push to main republishes a fresh -next.0. - publish.yaml: after stable publish, repoint @next at the just-published stable version. The existing derive-prerelease step picks max(latest, next) as its base, so subsequent push-driven prereleases bump from there. - bmad-cli.js: checkForUpdate was querying the @beta dist-tag (which this package does not use). Replace string-matching with semver.prerelease() and query @next for prerelease users. --- .github/workflows/publish.yaml | 11 +++++++++++ tools/installer/bmad-cli.js | 11 ++++------- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 0079a5e81..4e84b8baa 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -135,6 +135,17 @@ jobs: env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Advance @next dist-tag to stable + if: github.event_name == 'workflow_dispatch' && inputs.channel == 'latest' + run: | + # Without this, @latest can leapfrog @next (e.g. latest=6.5.0 while + # next=6.4.1-next.0) and `npx bmad-method@next install` silently + # downgrades users. Point @next at the just-published stable so + # @next >= @latest always holds; the next push-driven prerelease will + # bump from this base via the existing derive step above. + VERSION=$(node -p 'require("./package.json").version') + npm dist-tag add "bmad-method@${VERSION}" next + - name: Notify Discord if: github.event_name == 'workflow_dispatch' && inputs.channel == 'latest' continue-on-error: true diff --git a/tools/installer/bmad-cli.js b/tools/installer/bmad-cli.js index 042714e45..a108b3a44 100755 --- a/tools/installer/bmad-cli.js +++ b/tools/installer/bmad-cli.js @@ -23,13 +23,10 @@ checkForUpdate().catch(() => { async function checkForUpdate() { try { - // For beta versions, check the beta tag; otherwise check latest - const isBeta = - packageJson.version.includes('Beta') || - packageJson.version.includes('beta') || - packageJson.version.includes('alpha') || - packageJson.version.includes('rc'); - const tag = isBeta ? 'beta' : 'latest'; + // Prereleases (e.g. 6.5.1-next.0) live on the `next` dist-tag; stable + // releases live on `latest`. semver.prerelease() returns null for stable, + // so this correctly routes pre-1.0-next/rc/etc. without string matching. + const tag = semver.prerelease(packageJson.version) ? 'next' : 'latest'; const result = execSync(`npm view ${packageName}@${tag} version`, { encoding: 'utf8',