fix(publish): advance @next dist-tag after stable release (#2320)
* 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. * fix(publish): harden next-tag advance step and broaden path filter - continue-on-error on the dist-tag advance: failure leaves @next stale until the next push-driven prerelease, which is recoverable; failing the job after a successful publish + git tag + GH release is not. - Status echo so release-log triage can confirm the advance ran. - Add removals.txt to the push-trigger path filter. Installer-affecting changes outside src/** (like the post-6.5.0 removals.txt fix) should still trigger a fresh -next.0 publish.
This commit is contained in:
parent
88b9a1c842
commit
7baa30c567
|
|
@ -7,6 +7,7 @@ on:
|
||||||
- "src/**"
|
- "src/**"
|
||||||
- "tools/installer/**"
|
- "tools/installer/**"
|
||||||
- "package.json"
|
- "package.json"
|
||||||
|
- "removals.txt"
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
channel:
|
channel:
|
||||||
|
|
@ -135,6 +136,22 @@ 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'
|
||||||
|
# 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
|
- 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