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.
This commit is contained in:
parent
88b9a1c842
commit
5d93277cdb
|
|
@ -135,6 +135,17 @@ jobs:
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
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
|
- name: Notify Discord
|
||||||
if: github.event_name == 'workflow_dispatch' && inputs.channel == 'latest'
|
if: github.event_name == 'workflow_dispatch' && inputs.channel == 'latest'
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
|
|
|
||||||
|
|
@ -23,13 +23,10 @@ checkForUpdate().catch(() => {
|
||||||
|
|
||||||
async function checkForUpdate() {
|
async function checkForUpdate() {
|
||||||
try {
|
try {
|
||||||
// For beta versions, check the beta tag; otherwise check latest
|
// Prereleases (e.g. 6.5.1-next.0) live on the `next` dist-tag; stable
|
||||||
const isBeta =
|
// releases live on `latest`. semver.prerelease() returns null for stable,
|
||||||
packageJson.version.includes('Beta') ||
|
// so this correctly routes pre-1.0-next/rc/etc. without string matching.
|
||||||
packageJson.version.includes('beta') ||
|
const tag = semver.prerelease(packageJson.version) ? 'next' : 'latest';
|
||||||
packageJson.version.includes('alpha') ||
|
|
||||||
packageJson.version.includes('rc');
|
|
||||||
const tag = isBeta ? 'beta' : 'latest';
|
|
||||||
|
|
||||||
const result = execSync(`npm view ${packageName}@${tag} version`, {
|
const result = execSync(`npm view ${packageName}@${tag} version`, {
|
||||||
encoding: 'utf8',
|
encoding: 'utf8',
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue