Skip to content

Commit 89d2a4e

Browse files
os-zhuangclaude
andauthored
ci(release): unstick 17.0.0-rc.2 and stop an empty changeset from eating a release (#4898) (#4899)
17.0.0-rc.2 is versioned in main (3cfd9f0) and absent from npm. The Release run that should have published it reported success: Create Release Pull Request or Publish to npm ... 0s All changesets are empty; not creating PR changesets/action reaches its publish branch only when there are ZERO pending changesets. An EMPTY changeset still counts as pending, so a main carrying only empty ones takes neither path — no version PR, no publish, published=false, and a green run. `docker` skipped with it, so no runtime image shipped either. Two pending changesets were on main, both empty-frontmatter: #4893's and #4896's. Either one alone is enough. This is not an exotic state — `Check Changeset` sanctions the empty changeset as the "this PR releases nothing" declaration, so any docs/ci PR landing during the version-PR window produces it. Unstick: delete both. An empty-frontmatter changeset declares no releases, so it contributes no entry to any package's CHANGELOG — deleting it discards nothing. Its only job was to satisfy `Check Changeset` for PRs that merged hours ago. With the pending set empty, the next push to main takes the action's normal publish path, which ships the GitHub Releases and the ADR-0087 D4 spec-changes attachment along with npm and Docker. This PR therefore adds no changeset of its own — it carries the `skip-changeset` label instead. Adding an empty one would re-create the exact condition being removed and force the release down the degraded fallback path below. Prevent the silent recurrence: a recovery step after the changesets action, gated on the only fact that matters — the version in the repo is not on the registry. `changeset publish` skips versions already published, so it is a no-op on the normal path (main's version IS the last released one) and a repair on this one. It never succeeds silently: if the version is still missing after publishing, the job fails. The job's `published` / `cli-version` outputs now accept either publish path, so a rescued release still ships its Docker image instead of losing it to the same hole. The fallback cannot create GitHub Releases or the spec-changes attachment — those live inside the action's own publish path — so it says so in a warning rather than leaving the gap to be discovered later. Verified: YAML parses, both job outputs resolve on each path, the step's shell passes `bash -n`, and all three branches were exercised against stubbed npm/pnpm/git — already-published (no-op, exit 0), missing (publishes, sets published/version), and missing-after-publish (::error::, exit 1). Claude-Session: https://claude.ai/code/session_01BbNVKv6KgPzuQ5p76nMgnf Co-authored-by: Claude <noreply@anthropic.com>
1 parent 3cfd9f0 commit 89d2a4e

3 files changed

Lines changed: 51 additions & 74 deletions

File tree

.changeset/pm-skill-landing-and-ci-discipline.md

Lines changed: 0 additions & 27 deletions
This file was deleted.

.changeset/release-pr-ci-gates.md

Lines changed: 0 additions & 45 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 51 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,11 @@ jobs:
1515
contents: write
1616
pull-requests: write
1717
outputs:
18-
published: ${{ steps.changesets.outputs.published }}
19-
cli-version: ${{ steps.cli-version.outputs.version }}
18+
# Either publish path counts (see the recovery step below) — the Docker
19+
# image must ship for a release the fallback rescued just as much as for
20+
# one the Changesets action published itself.
21+
published: ${{ steps.changesets.outputs.published == 'true' || steps.recover-publish.outputs.published == 'true' }}
22+
cli-version: ${{ steps.cli-version.outputs.version || steps.recover-publish.outputs.version }}
2023
steps:
2124
- name: Checkout repository
2225
uses: actions/checkout@v7
@@ -159,6 +162,52 @@ jobs:
159162
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
160163
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
161164

165+
- name: Publish a release the Changesets action left behind
166+
id: recover-publish
167+
if: steps.changesets.outputs.published != 'true'
168+
# changesets/action reaches its publish branch ONLY when there are zero
169+
# pending changesets. An EMPTY changeset still counts as pending, so a
170+
# `main` carrying only empty ones lands in
171+
# All changesets are empty; not creating PR
172+
# and returns: no version PR, no publish, `published=false`, and a GREEN
173+
# run. The version bump is already committed by then, so the release
174+
# simply evaporates — 17.0.0-rc.2 sat versioned-in-repo and absent from
175+
# npm with Release reporting success, and `docker` skipped with it
176+
# (#4898). This is not an exotic state: `Check Changeset` sanctions the
177+
# empty changeset as the "this PR releases nothing" declaration, so any
178+
# ordinary docs/ci PR landing during the version-PR window produces it.
179+
#
180+
# Detect it by the only fact that matters — the version in the repo is
181+
# not on the registry — and repair it. `changeset publish` skips every
182+
# version already published, so this is a no-op on the normal path
183+
# (where main's version IS the last released one) and a repair on this
184+
# one. Never a silent success: if the version is still missing after
185+
# publishing, the job fails.
186+
env:
187+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
188+
run: |
189+
version=$(node -p "require('./packages/cli/package.json').version")
190+
if npm view "@objectstack/cli@$version" version >/dev/null 2>&1; then
191+
echo "@objectstack/cli@$version is already on npm — nothing left to publish."
192+
exit 0
193+
fi
194+
195+
echo "::warning::@objectstack/cli@$version is versioned in main but absent from npm and the Changesets action did not publish it (#4898) — publishing it now."
196+
printf '//registry.npmjs.org/:_authToken=%s\n' "$NPM_TOKEN" >> "$HOME/.npmrc"
197+
git config user.name 'github-actions[bot]'
198+
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
199+
pnpm run release
200+
201+
if ! npm view "@objectstack/cli@$version" version >/dev/null 2>&1; then
202+
echo "::error::publish ran but @objectstack/cli@$version is still not on npm"
203+
exit 1
204+
fi
205+
{
206+
echo "published=true"
207+
echo "version=$version"
208+
} >> "$GITHUB_OUTPUT"
209+
echo "::warning::Recovered by the fallback path — npm packages and git tags are published, but the GitHub Releases and the ADR-0087 D4 spec-changes attachment were NOT created (those only exist on the Changesets action's own publish path). Create them by hand if this release needs them."
210+
162211
- name: Attach spec-changes.json to the GitHub Release (ADR-0087 D4)
163212
# Rebuilds the change manifest with the api-surface diff against the
164213
# previously PUBLISHED spec (reusing the ADR-0059 §3 gate artifact) and

0 commit comments

Comments
 (0)