diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8a76adf2..843db0d3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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 @@ -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: diff --git a/RELEASING.md b/RELEASING.md index c29588d9..ec1a3d0e 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -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.