Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,20 @@ jobs:
run: pnpm install --frozen-lockfile

- name: Validate release mode
id: release-mode
shell: bash
run: |
if [[ "$GITHUB_REF_NAME" == "next" ]]; then
if [[ ! -e .changeset/pre.json && ! -L .changeset/pre.json ]]; then
if [[ "$GITHUB_EVENT_NAME" == "push" ]]; then
echo 'should-release=false' >> "$GITHUB_OUTPUT"
echo 'Skipping release: next is dormant until a new prerelease cycle starts.'
echo 'Release skipped: `next` has no `.changeset/pre.json`. Start a new prerelease cycle as described in RELEASING.md before releasing.' >> "$GITHUB_STEP_SUMMARY"
exit 0
fi
echo '::error::Cannot release from dormant next. Run pnpm changeset pre enter next, commit .changeset/pre.json, and push to start a new prerelease cycle. See RELEASING.md.'
exit 1
fi
jq -e \
'.mode == "pre" and (.tag == "next" or .tag == "rc")' \
.changeset/pre.json
Expand All @@ -65,8 +76,10 @@ jobs:
echo 'Normal releases must run from main or next.'
exit 1
fi
echo 'should-release=true' >> "$GITHUB_OUTPUT"

- name: Create Version PR or Publish
if: steps.release-mode.outputs.should-release == 'true'
id: changesets
uses: changesets/action@v1
with:
Expand Down
8 changes: 8 additions & 0 deletions RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,14 @@ git commit -m "chore: start next prerelease cycle"
git push
```

Between release cycles, `next` may be dormant with no `.changeset/pre.json`.
Automatic pushes to dormant `next` succeed with a release-skipped summary and
skip the entire Changesets version/publish action, including for forward merges
from `main`. Manually selecting the `release` operation on dormant `next` fails
with instructions to start the new prerelease cycle using the commands above.
An existing prerelease file must still contain valid JSON with `"mode": "pre"`
and a supported `next` or `rc` tag; invalid state fails the release workflow.

If `next` advanced after the promotion PR was created, resolve the merge and
prerelease-state conflict while preserving those later changes.

Expand Down
Loading