diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 0079a5e81..696ac8f6a 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -7,6 +7,7 @@ on: - "src/**" - "tools/installer/**" - "package.json" + - "removals.txt" workflow_dispatch: inputs: channel: @@ -135,6 +136,22 @@ jobs: env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Advance @next dist-tag to stable + if: github.event_name == 'workflow_dispatch' && inputs.channel == 'latest' + # Failure here leaves @next stale until the next push-driven prerelease + # republishes — annoying but not release-breaking. Don't fail the job + # after a successful stable publish + tag + GH release. + continue-on-error: true + 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 + echo "Advanced @next dist-tag to ${VERSION}" + - 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',