From fb23029082b14d083fb9ed340756243d57de1182 Mon Sep 17 00:00:00 2001 From: Jens Meisner Date: Fri, 13 Nov 2026 10:38:36 +0100 Subject: [PATCH 1/6] ci: Support maintenance branches per major with Changesets Add maintenance/ branches as release lines of their own, so an older major can still receive patch and minor releases while main moves on (see VERSIONING.md). Each branch has its own changesets, "Version Packages" pull request, QA gate queue and releases. - create-maintenance-branch.yml (manual, input: major): creates maintenance/ from the newest release of that major, sets the Changesets base branch and drops pending changesets. It rejects existing branches, majors above main's, and releases made with the old release process. - qa-gate.yml, create-or-update-release-pr.yml and release-and-publish.yml also run for maintenance/*. They work on the pull request's base branch or the pushed branch instead of a hard-coded main, with one QA gate queue per branch. - Maintenance releases use the npm dist-tag maintenance-, so latest stays on main. Their GitHub release is not marked as latest, and the documentation is only deployed from main. - snapshot.yml: snapshots of an older major than main use the dist-tag snapshot-maintenance-. - pull-request.yml compares against the pull request's base branch; manual runs skip the changeset check. - checks action: on maintenance/, reject major changesets and a package version of another major. On main, reject an unreleased version whose major already has a maintenance branch, so main and a maintenance branch never release the same major. This allows creating maintenance/ while main is still on that major, e.g. right before breaking changes. The legacy maintenance/23.0, 24.0 and 25.0 branches are unaffected: they only run their own workflow files. Document maintenance branches with an example in DEVELOPMENT.md. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .github/actions/checks/action.yml | 69 +++++++++++ .../workflows/create-maintenance-branch.yml | 107 ++++++++++++++++++ .../workflows/create-or-update-release-pr.yml | 4 +- .github/workflows/pull-request.yml | 4 +- .github/workflows/qa-gate.yml | 44 ++++--- .github/workflows/release-and-publish.yml | 24 +++- .github/workflows/snapshot.yml | 15 ++- DEVELOPMENT.md | 39 +++++++ 8 files changed, 282 insertions(+), 24 deletions(-) create mode 100644 .github/workflows/create-maintenance-branch.yml diff --git a/.github/actions/checks/action.yml b/.github/actions/checks/action.yml index b38cd4c9d0..e998ac3c61 100644 --- a/.github/actions/checks/action.yml +++ b/.github/actions/checks/action.yml @@ -10,6 +10,10 @@ inputs: description: 'Ref the changeset check compares against. Leave empty to skip it, e.g. for a release.' required: false default: '' + target-branch: + description: 'Branch the checked change goes into. On "maintenance/" major bumps are rejected.' + required: false + default: '' runs: using: 'composite' @@ -41,6 +45,57 @@ runs: # Rejects unparsable frontmatter, unknown package names and invalid bump types. pnpm changeset status --since="$BASE_REF" + # A maintenance branch stays on its major; main moves on to higher majors (see + # "Check main release line"), so a major bump would collide with main's versions. + - name: Check maintenance release line + id: maintenance-check + if: ${{ startsWith(inputs.target-branch, 'maintenance/') }} + continue-on-error: ${{ inputs.perform-all-checks == 'true' }} + shell: bash + env: + TARGET_BRANCH: ${{ inputs.target-branch }} + run: | + BRANCH_MAJOR="${TARGET_BRANCH#maintenance/}" + VERSION_MAJOR=$(jq -r .version packages/ckeditor5-common/package.json | cut -d. -f1) + if [ "$VERSION_MAJOR" != "$BRANCH_MAJOR" ]; then + echo "::error::$TARGET_BRANCH holds version $VERSION_MAJOR.x.x; maintenance branches are named maintenance/." + exit 1 + fi + + MAJOR_CHANGESETS=$(for f in .changeset/*.md; do + [ "$(basename "$f")" = README.md ] && continue + awk 'NR == 1 && $0 == "---" { fm = 1; next } fm && $0 == "---" { exit } fm' "$f" \ + | grep -qE ":[[:space:]]*[\"']?major[\"']?[[:space:]]*$" && echo "$f" + done || true) + if [ -n "$MAJOR_CHANGESETS" ]; then + echo "::error::Major changes are not allowed on $TARGET_BRANCH; use patch or minor:" + echo "$MAJOR_CHANGESETS" + exit 1 + fi + echo "No major changesets on $TARGET_BRANCH." + + # Counterpart on main: once maintenance/ exists (it may be created while main is + # still on that major), main must not release that major again. Only an unreleased + # version, i.e. the "Version Packages" PR and the release itself, is checked, so other + # pull requests are not blocked. + - name: Check main release line + id: main-line-check + if: ${{ inputs.target-branch == 'main' }} + continue-on-error: ${{ inputs.perform-all-checks == 'true' }} + shell: bash + run: | + VERSION=$(jq -r .version packages/ckeditor5-common/package.json) + if git rev-parse -q --verify "refs/tags/$VERSION" > /dev/null; then + echo "$VERSION is already released; nothing to check." + exit 0 + fi + MAJOR="${VERSION%%.*}" + if git ls-remote --exit-code --heads origin "maintenance/$MAJOR" > /dev/null; then + echo "::error::maintenance/$MAJOR exists, so main must not release $VERSION: its next release must be major. Add a 'major' changeset on main." + exit 1 + fi + echo "main may release $VERSION." + - uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 id: playwright-cache with: @@ -114,6 +169,20 @@ runs: FAILED=true fi + if [ "${{ steps.maintenance-check.outcome }}" == "failure" ]; then + echo "❌ Maintenance release line check failed" >> $GITHUB_STEP_SUMMARY + FAILED=true + elif [ "${{ steps.maintenance-check.outcome }}" == "success" ]; then + echo "✅ Maintenance release line check passed" >> $GITHUB_STEP_SUMMARY + fi + + if [ "${{ steps.main-line-check.outcome }}" == "failure" ]; then + echo "❌ Main release line check failed" >> $GITHUB_STEP_SUMMARY + FAILED=true + elif [ "${{ steps.main-line-check.outcome }}" == "success" ]; then + echo "✅ Main release line check passed" >> $GITHUB_STEP_SUMMARY + fi + if [ "${{ steps.unit-tests.outcome }}" == "success" ]; then echo "✅ Unit tests passed" >> $GITHUB_STEP_SUMMARY else diff --git a/.github/workflows/create-maintenance-branch.yml b/.github/workflows/create-maintenance-branch.yml new file mode 100644 index 0000000000..e316914ccb --- /dev/null +++ b/.github/workflows/create-maintenance-branch.yml @@ -0,0 +1,107 @@ +name: "Create Maintenance Branch" + +# Creates maintenance/ for an older major, so it can receive patch and minor +# releases while main moves on. The branch is a release line of its own: changesets, +# "Version Packages" PR, QA gate and release work there just like on main. +on: + workflow_dispatch: + inputs: + major: + description: 'Major version to maintain, e.g. "28" creates maintenance/28 from the latest 28.x.y release' + required: true + type: string + +permissions: + contents: read + +run-name: | + Create maintenance/${{ inputs.major }} + +jobs: + create: + name: Create maintenance/${{ inputs.major }} + runs-on: ubuntu-latest + steps: + - name: Checkout main + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + ref: main + fetch-depth: 0 + # Pushes to maintenance/* are restricted by the ruleset; coremedia-ci bypasses it. + token: ${{ secrets.GH_PAT_PUSH_FROM_GHA }} + + - name: Configure Git + run: | + git config user.name 'coremedia-ci' + git config user.email 'coremedia-ci@coremedia.com' + + - name: Validate + id: validate + env: + MAJOR: ${{ inputs.major }} + run: | + fail() { echo "::error::$1"; exit 1; } + + [[ "$MAJOR" =~ ^[1-9][0-9]*$ ]] || fail "\"$MAJOR\" is not a major version number." + BRANCH="maintenance/$MAJOR" + + if git ls-remote --exit-code --heads origin "$BRANCH" > /dev/null; then + fail "$BRANCH already exists." + fi + + # main may be on the same major (e.g. right before breaking changes): the checks + # action then rejects any further release of $MAJOR.x.y from main. + MAIN_MAJOR=$(jq -r .version packages/ckeditor5-common/package.json | cut -d. -f1) + [ "$MAIN_MAJOR" -ge "$MAJOR" ] \ + || fail "main is on major $MAIN_MAJOR; there is no release of major $MAJOR to maintain." + + TAG=$(git tag --list "$MAJOR.*" | grep -E "^$MAJOR\.[0-9]+\.[0-9]+$" | sort -V | tail -n 1 || true) + [ -n "$TAG" ] || fail "No release $MAJOR.x.y found." + + # Releases made with the old release process have neither Changesets nor these + # workflows, so a branch cut from them could not release. + git cat-file -e "$TAG:.github/workflows/create-maintenance-branch.yml" 2> /dev/null \ + || fail "Release $TAG predates the Changesets-based maintenance support; cut the branch manually or release $MAJOR.x.y from main first." + + echo "Creating $BRANCH from $TAG (main is on major $MAIN_MAJOR)" + { + echo "branch=$BRANCH" + echo "tag=$TAG" + echo "main-major=$MAIN_MAJOR" + } >> "$GITHUB_OUTPUT" + + - name: Create and push branch + env: + BRANCH: ${{ steps.validate.outputs.branch }} + TAG: ${{ steps.validate.outputs.tag }} + run: | + git switch -c "$BRANCH" "$TAG" + + # Changesets compares against its base branch, e.g. in "changeset status". + jq --indent 2 --arg branch "$BRANCH" '.baseBranch = $branch' .changeset/config.json \ + > "$RUNNER_TEMP/config.json" + mv "$RUNNER_TEMP/config.json" .changeset/config.json + # Changesets pending at the release tag belong to main's next release. + find .changeset -maxdepth 1 -name '*.md' ! -name 'README.md' -delete + + git add -A .changeset + git commit -m "ci: Create $BRANCH from $TAG" + git push origin "$BRANCH" + + - name: Summary + env: + BRANCH: ${{ steps.validate.outputs.branch }} + TAG: ${{ steps.validate.outputs.tag }} + MAJOR: ${{ inputs.major }} + MAIN_MAJOR: ${{ steps.validate.outputs.main-major }} + run: | + { + echo "## ✅ Created [$BRANCH](${{ github.server_url }}/${{ github.repository }}/tree/$BRANCH) from $TAG" + echo "" + echo "- Open pull requests against \`$BRANCH\`; they need a \`patch\` or \`minor\` changeset." + echo "- Releases are published with the npm dist-tag \`maintenance-$MAJOR\` and do not become \`latest\`." + if [ "$MAIN_MAJOR" = "$MAJOR" ]; then + echo "- main is still on major $MAJOR: its next release must be major. Its \"Version Packages\" pull request fails until a \`major\` changeset is pending on main." + fi + echo "- Dependabot only updates main: add an entry with \`target-branch: $BRANCH\` to \`.github/dependabot.yml\` on main if this line should get action updates." + } >> "$GITHUB_STEP_SUMMARY" diff --git a/.github/workflows/create-or-update-release-pr.yml b/.github/workflows/create-or-update-release-pr.yml index e63f3f9fcf..16ccf47ea9 100644 --- a/.github/workflows/create-or-update-release-pr.yml +++ b/.github/workflows/create-or-update-release-pr.yml @@ -4,6 +4,7 @@ on: push: branches: - main + - 'maintenance/*' permissions: contents: write @@ -44,5 +45,6 @@ jobs: uses: changesets/action@8488615a623b1b9c987934bb89eae8af6a946ac1 # v2.1.1 with: version-script: pnpm ci:version - pr-base-branch: main + # One "Version Packages" PR per release line (branch changeset-release/). + pr-base-branch: ${{ github.ref_name }} github-token: ${{ secrets.GH_PAT_PUSH_FROM_GHA }} diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 2dbcc58a87..62bf945a63 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -49,7 +49,9 @@ jobs: uses: ./.github/actions/checks with: perform-all-checks: 'true' - base-ref: origin/main + # Manual runs have no base to compare against, so they skip the changeset check. + base-ref: ${{ github.event_name == 'pull_request' && format('origin/{0}', github.base_ref) || '' }} + target-branch: ${{ github.base_ref || github.ref_name }} fork: name: Fork Pull Request diff --git a/.github/workflows/qa-gate.yml b/.github/workflows/qa-gate.yml index 896fdd9178..332161adc2 100644 --- a/.github/workflows/qa-gate.yml +++ b/.github/workflows/qa-gate.yml @@ -5,13 +5,20 @@ on: types: [labeled, unlabeled] branches: - main + # Release lines created by create-maintenance-branch.yml. The legacy maintenance/.0 + # branches do not run this: pull_request_target uses the base branch's workflow files. + - 'maintenance/*' permissions: contents: write pull-requests: write +env: + # Every release line has its own queue: main or maintenance/. + BASE_BRANCH: ${{ github.event.pull_request.base.ref }} + concurrency: - group: qa-gate-main + group: qa-gate-${{ github.event.pull_request.base.ref }} cancel-in-progress: false run-name: | @@ -37,10 +44,10 @@ jobs: env: GH_TOKEN: ${{ github.token }} run: | - # Get all open PRs into main with 'approved' label but without 'qa-failed', sorted by updated_at (oldest first) + # Get all open PRs into the base branch with 'approved' label but without 'qa-failed', sorted by updated_at (oldest first) OLDEST_PR=$(gh api \ -H "Accept: application/vnd.github+json" \ - "/repos/${{ github.repository }}/pulls?state=open&base=main&sort=updated&direction=asc" \ + "/repos/${{ github.repository }}/pulls?state=open&base=${BASE_BRANCH}&sort=updated&direction=asc" \ --jq '[.[] | select((.labels | map(.name) | contains(["approved"])) and (.labels | map(.name) | contains(["qa-failed"]) | not))] | first | .number') CURRENT_PR=${{ github.event.pull_request.number }} @@ -79,10 +86,10 @@ jobs: needs: check-queue if: needs.check-queue.outputs.should-proceed == 'true' steps: - - name: Checkout main + - name: Checkout base branch uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: - ref: main + ref: ${{ env.BASE_BRANCH }} fetch-depth: 0 token: ${{ secrets.GH_PAT_PUSH_FROM_GHA }} @@ -104,10 +111,10 @@ jobs: # targets (git rebase -i --autosquash) before the PR can be integrated. MARKER_COMMITS=$(git log --no-merges -E \ --grep='^(fixup|squash|amend)! ' \ - --format='%h %s' "main..origin/$PR_BRANCH" || true) + --format='%h %s' "${BASE_BRANCH}..origin/$PR_BRANCH" || true) if [ -n "$MARKER_COMMITS" ]; then - echo "::error::The PR contains fixup!/squash!/amend! commits. Run 'git rebase -i --autosquash main' and push before integration." + echo "::error::The PR contains fixup!/squash!/amend! commits. Run 'git rebase -i --autosquash ${BASE_BRANCH}' and push before integration." { echo "## ❌ Autosquash commits found" echo "" @@ -122,7 +129,7 @@ jobs: echo "No fixup/squash commits found." - - name: Merge PR branch into main + - name: Merge PR branch into base branch env: PR_BRANCH: ${{ needs.check-queue.outputs.pr-branch }} PR_NUMBER: ${{ needs.check-queue.outputs.pr-number }} @@ -130,7 +137,7 @@ jobs: echo "Fetching PR branch: $PR_BRANCH" git fetch origin "$PR_BRANCH" - echo "Merging $PR_BRANCH into main" + echo "Merging $PR_BRANCH into $BASE_BRANCH" if ! git merge "origin/$PR_BRANCH" --no-edit -m "Merge PR #$PR_NUMBER"; then echo "::error::Merge conflict detected. Please rebase your branch." exit 1 @@ -148,25 +155,26 @@ jobs: - name: Checks uses: ./.github/actions/checks with: - base-ref: origin/main + base-ref: origin/${{ env.BASE_BRANCH }} + target-branch: ${{ env.BASE_BRANCH }} - - name: Push to main + - name: Push to base branch env: PR_NUMBER: ${{ needs.check-queue.outputs.pr-number }} run: | - echo "Pushing to main..." - git push origin main + echo "Pushing to $BASE_BRANCH..." + git push origin "$BASE_BRANCH" # Update local tracking to match remote after push - git fetch origin main - git branch --set-upstream-to=origin/main main + git fetch origin "$BASE_BRANCH" + git branch --set-upstream-to="origin/$BASE_BRANCH" "$BASE_BRANCH" - echo "## ✅ PR #$PR_NUMBER successfully integrated" >> $GITHUB_STEP_SUMMARY + echo "## ✅ PR #$PR_NUMBER successfully integrated into $BASE_BRANCH" >> $GITHUB_STEP_SUMMARY - - name: Deploy Storybook for main + - name: Deploy Storybook for base branch uses: ./.github/actions/deploy-storybook with: - branch-name: main + branch-name: ${{ env.BASE_BRANCH }} ckeditor-license: ${{ secrets.CKEDITOR_LICENSE }} on-failure: diff --git a/.github/workflows/release-and-publish.yml b/.github/workflows/release-and-publish.yml index 327f0444ed..719b1dc3f3 100644 --- a/.github/workflows/release-and-publish.yml +++ b/.github/workflows/release-and-publish.yml @@ -6,6 +6,7 @@ on: push: branches: - main + - 'maintenance/*' permissions: contents: write @@ -69,6 +70,21 @@ jobs: - name: Checks uses: ./.github/actions/checks + with: + target-branch: ${{ github.ref_name }} + + # Releases from a maintenance branch must not become "latest": consumers of the + # newest major get it from main. + - name: Determine release line + id: line + run: | + if [[ "$GITHUB_REF_NAME" == maintenance/* ]]; then + echo "dist-tag=maintenance-${GITHUB_REF_NAME#maintenance/}" >> "$GITHUB_OUTPUT" + echo "latest=false" >> "$GITHUB_OUTPUT" + else + echo "dist-tag=" >> "$GITHUB_OUTPUT" + echo "latest=true" >> "$GITHUB_OUTPUT" + fi - name: Setup npm registries for publish run: | @@ -83,7 +99,7 @@ jobs: id: changesets uses: changesets/action@8488615a623b1b9c987934bb89eae8af6a946ac1 # v2.1.1 with: - publish-script: pnpm ci:publish + publish-script: ${{ steps.line.outputs.dist-tag && format('pnpm ci:publish --tag {0}', steps.line.outputs.dist-tag) || 'pnpm ci:publish' }} github-token: ${{ github.token }} # One aggregate release per version instead of one per package (see below). create-github-releases: false @@ -108,16 +124,18 @@ jobs: node scripts/release-notes.mjs "$VERSION" > "$RUNNER_TEMP/release-notes.md" git tag -a "$VERSION" -m "$VERSION" git push origin "$VERSION" - gh release create "$VERSION" --verify-tag --title "v$VERSION" --notes-file "$RUNNER_TEMP/release-notes.md" + gh release create "$VERSION" --verify-tag --title "v$VERSION" --notes-file "$RUNNER_TEMP/release-notes.md" \ + --latest=${{ steps.line.outputs.latest }} echo "## Released $VERSION" >> "$GITHUB_STEP_SUMMARY" # Separate job, so a manual run deploys the documentation even while changesets are # pending and the release job is skipped (e.g. to initially fill gh-pages). + # GitHub Pages documents main only. docs: name: Deploy documentation needs: [check-changesets, release] if: >- - !cancelled() && needs.release.result != 'failure' && + !cancelled() && needs.release.result != 'failure' && github.ref_name == 'main' && (needs.release.outputs.published == 'true' || github.event_name == 'workflow_dispatch') runs-on: ubuntu-latest timeout-minutes: 20 diff --git a/.github/workflows/snapshot.yml b/.github/workflows/snapshot.yml index b3070004b1..a9f9e16227 100644 --- a/.github/workflows/snapshot.yml +++ b/.github/workflows/snapshot.yml @@ -37,6 +37,17 @@ jobs: echo "Calculated snapshot version: ${next_version}" echo "version=${next_version}" >> $GITHUB_OUTPUT + # Snapshots of an older major (a maintenance branch or a branch based on one) get + # their own dist-tag, so "snapshot" keeps pointing to snapshots of main. + main_major=$(git show origin/main:packages/ckeditor5-common/package.json | jq -r .version | cut -d. -f1) + if [ "$major" = "$main_major" ]; then + dist_tag=snapshot + else + dist_tag="snapshot-maintenance-${major}" + fi + echo "Dist-tag: ${dist_tag}" + echo "dist-tag=${dist_tag}" >> $GITHUB_OUTPUT + - name: Build uses: ./.github/actions/build with: @@ -49,6 +60,7 @@ jobs: env: NEXUS_USER: ${{ secrets.PLUGINS_NEXUS_USER }} NEXUS_PASSWORD: ${{ secrets.PLUGINS_NEXUS_PASSWORD }} + DIST_TAG: ${{ steps.version.outputs.dist-tag }} run: | TARGET_REGISTRY="https://repository.coremedia.com/nexus/repository/npm-github-hosted/" @@ -70,7 +82,7 @@ jobs: echo "Publishing packages to $TARGET_REGISTRY" # Publish all packages directly - pnpm -r publish --tag snapshot --no-git-checks + pnpm -r publish --tag "$DIST_TAG" --no-git-checks mv "$GITHUB_WORKSPACE/.npmrc.bak" "$GITHUB_WORKSPACE/.npmrc" @@ -84,6 +96,7 @@ jobs: echo "## ✅ Snapshot published" >> $GITHUB_STEP_SUMMARY echo "**Version:** ${{ steps.version.outputs.version }}" >> $GITHUB_STEP_SUMMARY echo "**Registry:** npm-github-hosted" >> $GITHUB_STEP_SUMMARY + echo "**Dist-tag:** ${DIST_TAG}" >> $GITHUB_STEP_SUMMARY echo "" >> $GITHUB_STEP_SUMMARY echo "### pnpm-workspace.yaml catalog entries" >> $GITHUB_STEP_SUMMARY echo "Add the following to your \`pnpm-workspace.yaml\` under \`catalog:\`:" >> $GITHUB_STEP_SUMMARY diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 8a889ab0ff..f77b43cdf5 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -45,6 +45,45 @@ pnpm changeset add --empty All published packages share one version: a changeset for one package bumps all of them. +## Maintenance Branches + +`main` holds the newest major. To ship fixes for an older major (see +[Versioning](./VERSIONING.md)), create a maintenance branch `maintenance/` +with the GitHub Actions workflow _Create Maintenance Branch_ (input: the major, +e.g. `30`). It creates the branch from the newest release of that major. + +A maintenance branch is a release line of its own and works like `main`: pull +requests need a changeset, are integrated by the QA gate, and are released via a +"Version Packages" pull request. Differences: + +* Only `patch` and `minor` changesets are allowed; `major` changesets are rejected. +* Releases are published with the npm dist-tag `maintenance-`, so `latest` + keeps pointing to the newest release from `main`. Their GitHub release is not + marked as latest. +* The API documentation on GitHub Pages is only deployed from `main`. + +A fix needed on both lines is made on one branch and cherry-picked to the other, +including its changeset. `main` and maintenance branches are never merged into each +other. + +**Example:** + +1. `main` is released up to `30.4.2`; a CMCC version is bound to major 30. +2. `main` moves on with breaking changes and releases `31.0.0`, `31.1.0` and + `32.0.0`. +3. A customer on that CMCC version needs a security fix, still on major 30. +4. _Create Maintenance Branch_ with `30` creates `maintenance/30` from `30.4.2`. +5. The fix is cherry-picked into `maintenance/30` with a `patch` changeset and + released as `30.4.3` (dist-tag `maintenance-30`); `latest` stays on `32.x`. + +The branch may also be created while `main` is still on that major, e.g. right +before breaking changes. `main` must then not release that major again: its +"Version Packages" pull request fails until a `major` changeset is pending. + +Only releases made with Changesets can be used as starting point. Releases of the +old release process (up to `28.1.1`) and the legacy branches `maintenance/23.0`, +`24.0` and `25.0` are not supported by this workflow. + ## Update Process All dependency versions are maintained centrally in the `catalog` of From 97454e495a391aed6a6abba4641be64fd2172338 Mon Sep 17 00:00:00 2001 From: Jens Meisner Date: Fri, 13 Nov 2026 15:51:51 +0100 Subject: [PATCH 2/6] added changeset --- .changeset/support-maintenance-branches.md | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .changeset/support-maintenance-branches.md diff --git a/.changeset/support-maintenance-branches.md b/.changeset/support-maintenance-branches.md new file mode 100644 index 0000000000..a845151cc8 --- /dev/null +++ b/.changeset/support-maintenance-branches.md @@ -0,0 +1,2 @@ +--- +--- From 5c8f2060eab4dc20424a3802289179856262ba2b Mon Sep 17 00:00:00 2001 From: Jens Meisner Date: Mon, 16 Nov 2026 10:08:06 +0100 Subject: [PATCH 3/6] ci: Keep main releasable when a maintenance branch exists The main release line check rejected every pull request into main while main held an unreleased version whose major already had a maintenance branch. Besides the "Version Packages" pull request, this also happens after a failed release. The pull request adding the required major changeset then failed the same check, so main could not be fixed without bypassing the ruleset. - checks action: on main, accept an unreleased version whose major has a maintenance branch if a major changeset is pending, because the next release is then major. - create-maintenance-branch.yml: when main is still on the requested major, require main's version to be released. Otherwise the branch would be cut from an older release, leaving the unreleased changes behind. - Move the detection of major changesets into .github/scripts/major-changesets.sh, used by both release line checks. It no longer pipes into "grep -q", so awk cannot fail on a closed pipe under pipefail. Document the precondition in DEVELOPMENT.md. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .github/actions/checks/action.yml | 26 +++++++++++-------- .github/scripts/major-changesets.sh | 14 ++++++++++ .../workflows/create-maintenance-branch.yml | 10 ++++++- DEVELOPMENT.md | 6 +++-- 4 files changed, 42 insertions(+), 14 deletions(-) create mode 100644 .github/scripts/major-changesets.sh diff --git a/.github/actions/checks/action.yml b/.github/actions/checks/action.yml index e998ac3c61..2bb5952165 100644 --- a/.github/actions/checks/action.yml +++ b/.github/actions/checks/action.yml @@ -62,11 +62,7 @@ runs: exit 1 fi - MAJOR_CHANGESETS=$(for f in .changeset/*.md; do - [ "$(basename "$f")" = README.md ] && continue - awk 'NR == 1 && $0 == "---" { fm = 1; next } fm && $0 == "---" { exit } fm' "$f" \ - | grep -qE ":[[:space:]]*[\"']?major[\"']?[[:space:]]*$" && echo "$f" - done || true) + MAJOR_CHANGESETS=$(bash "$GITHUB_WORKSPACE/.github/scripts/major-changesets.sh") if [ -n "$MAJOR_CHANGESETS" ]; then echo "::error::Major changes are not allowed on $TARGET_BRANCH; use patch or minor:" echo "$MAJOR_CHANGESETS" @@ -76,8 +72,9 @@ runs: # Counterpart on main: once maintenance/ exists (it may be created while main is # still on that major), main must not release that major again. Only an unreleased - # version, i.e. the "Version Packages" PR and the release itself, is checked, so other - # pull requests are not blocked. + # version is checked: the "Version Packages" PR and the release itself, but also main + # after a failed release. A pending major changeset makes the next release major, so it + # passes; otherwise the pull request adding it could never be integrated. - name: Check main release line id: main-line-check if: ${{ inputs.target-branch == 'main' }} @@ -90,11 +87,18 @@ runs: exit 0 fi MAJOR="${VERSION%%.*}" - if git ls-remote --exit-code --heads origin "maintenance/$MAJOR" > /dev/null; then - echo "::error::maintenance/$MAJOR exists, so main must not release $VERSION: its next release must be major. Add a 'major' changeset on main." - exit 1 + if ! git ls-remote --exit-code --heads origin "maintenance/$MAJOR" > /dev/null; then + echo "main may release $VERSION." + exit 0 + fi + MAJOR_CHANGESETS=$(bash "$GITHUB_WORKSPACE/.github/scripts/major-changesets.sh") + if [ -n "$MAJOR_CHANGESETS" ]; then + echo "maintenance/$MAJOR exists, but the next release is major:" + echo "$MAJOR_CHANGESETS" + exit 0 fi - echo "main may release $VERSION." + echo "::error::maintenance/$MAJOR exists, so main must not release $VERSION: its next release must be major. Add a 'major' changeset on main." + exit 1 - uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 id: playwright-cache diff --git a/.github/scripts/major-changesets.sh b/.github/scripts/major-changesets.sh new file mode 100644 index 0000000000..44516fbb72 --- /dev/null +++ b/.github/scripts/major-changesets.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash +# Prints the pending changesets that request a major bump, one per line. +# Runs in the repository root. +set -euo pipefail + +for f in .changeset/*.md; do + [ -e "$f" ] || continue + [ "$(basename "$f")" = README.md ] && continue + # Only the frontmatter holds bump types; no "grep -q", so awk never hits a closed pipe. + if awk 'NR == 1 && $0 == "---" { fm = 1; next } fm && $0 == "---" { exit } fm' "$f" \ + | grep -E ":[[:space:]]*[\"']?major[\"']?[[:space:]]*$" > /dev/null; then + echo "$f" + fi +done diff --git a/.github/workflows/create-maintenance-branch.yml b/.github/workflows/create-maintenance-branch.yml index e316914ccb..3486239f43 100644 --- a/.github/workflows/create-maintenance-branch.yml +++ b/.github/workflows/create-maintenance-branch.yml @@ -51,10 +51,18 @@ jobs: # main may be on the same major (e.g. right before breaking changes): the checks # action then rejects any further release of $MAJOR.x.y from main. - MAIN_MAJOR=$(jq -r .version packages/ckeditor5-common/package.json | cut -d. -f1) + MAIN_VERSION=$(jq -r .version packages/ckeditor5-common/package.json) + MAIN_MAJOR="${MAIN_VERSION%%.*}" [ "$MAIN_MAJOR" -ge "$MAJOR" ] \ || fail "main is on major $MAIN_MAJOR; there is no release of major $MAJOR to maintain." + # An unreleased version on main (e.g. after a failed release) would be left out of + # the branch, and main could not release it anymore. + if [ "$MAIN_MAJOR" -eq "$MAJOR" ]; then + git rev-parse -q --verify "refs/tags/$MAIN_VERSION" > /dev/null \ + || fail "main holds the unreleased version $MAIN_VERSION; release it first." + fi + TAG=$(git tag --list "$MAJOR.*" | grep -E "^$MAJOR\.[0-9]+\.[0-9]+$" | sort -V | tail -n 1 || true) [ -n "$TAG" ] || fail "No release $MAJOR.x.y found." diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index f77b43cdf5..e5eec846eb 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -77,8 +77,10 @@ other. released as `30.4.3` (dist-tag `maintenance-30`); `latest` stays on `32.x`. The branch may also be created while `main` is still on that major, e.g. right -before breaking changes. `main` must then not release that major again: its -"Version Packages" pull request fails until a `major` changeset is pending. +before breaking changes, as long as `main` has no unreleased version (e.g. after a +failed release). `main` must then not release that major again: its +"Version Packages" pull request and its release fail until a `major` changeset is +pending. Only releases made with Changesets can be used as starting point. Releases of the old release process (up to `28.1.1`) and the legacy branches `maintenance/23.0`, From 7694a95841587dd8800943f0ba9770680bd902e3 Mon Sep 17 00:00:00 2001 From: Jens Meisner Date: Mon, 16 Nov 2026 10:16:36 +0100 Subject: [PATCH 4/6] ci: Detect major changesets with the Changesets parser The release line checks found major changesets with a regular expression on the frontmatter, which missed valid YAML such as a trailing comment ("major # breaking"). Such a changeset passed the maintenance check and only failed on the "Version Packages" pull request. - scripts/major-changesets.mjs reads the pending changesets with @changesets/read, like "changeset version" does, and replaces .github/scripts/major-changesets.sh. An unparsable changeset now fails the check. - snapshot.yml: correct the comment on dist-tags. "snapshot" is shared by all snapshots of main's major, so it is not reserved for main. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .github/actions/checks/action.yml | 4 ++-- .github/scripts/major-changesets.sh | 14 -------------- .github/workflows/snapshot.yml | 5 +++-- scripts/major-changesets.mjs | 26 ++++++++++++++++++++++++++ 4 files changed, 31 insertions(+), 18 deletions(-) delete mode 100644 .github/scripts/major-changesets.sh create mode 100644 scripts/major-changesets.mjs diff --git a/.github/actions/checks/action.yml b/.github/actions/checks/action.yml index 2bb5952165..fbb51ff359 100644 --- a/.github/actions/checks/action.yml +++ b/.github/actions/checks/action.yml @@ -62,7 +62,7 @@ runs: exit 1 fi - MAJOR_CHANGESETS=$(bash "$GITHUB_WORKSPACE/.github/scripts/major-changesets.sh") + MAJOR_CHANGESETS=$(node scripts/major-changesets.mjs) if [ -n "$MAJOR_CHANGESETS" ]; then echo "::error::Major changes are not allowed on $TARGET_BRANCH; use patch or minor:" echo "$MAJOR_CHANGESETS" @@ -91,7 +91,7 @@ runs: echo "main may release $VERSION." exit 0 fi - MAJOR_CHANGESETS=$(bash "$GITHUB_WORKSPACE/.github/scripts/major-changesets.sh") + MAJOR_CHANGESETS=$(node scripts/major-changesets.mjs) if [ -n "$MAJOR_CHANGESETS" ]; then echo "maintenance/$MAJOR exists, but the next release is major:" echo "$MAJOR_CHANGESETS" diff --git a/.github/scripts/major-changesets.sh b/.github/scripts/major-changesets.sh deleted file mode 100644 index 44516fbb72..0000000000 --- a/.github/scripts/major-changesets.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env bash -# Prints the pending changesets that request a major bump, one per line. -# Runs in the repository root. -set -euo pipefail - -for f in .changeset/*.md; do - [ -e "$f" ] || continue - [ "$(basename "$f")" = README.md ] && continue - # Only the frontmatter holds bump types; no "grep -q", so awk never hits a closed pipe. - if awk 'NR == 1 && $0 == "---" { fm = 1; next } fm && $0 == "---" { exit } fm' "$f" \ - | grep -E ":[[:space:]]*[\"']?major[\"']?[[:space:]]*$" > /dev/null; then - echo "$f" - fi -done diff --git a/.github/workflows/snapshot.yml b/.github/workflows/snapshot.yml index a9f9e16227..ec025b7cf7 100644 --- a/.github/workflows/snapshot.yml +++ b/.github/workflows/snapshot.yml @@ -37,8 +37,9 @@ jobs: echo "Calculated snapshot version: ${next_version}" echo "version=${next_version}" >> $GITHUB_OUTPUT - # Snapshots of an older major (a maintenance branch or a branch based on one) get - # their own dist-tag, so "snapshot" keeps pointing to snapshots of main. + # Snapshots of an older major than main (a maintenance branch or a branch based on + # one) get their own dist-tag. All snapshots of main's major share "snapshot", also + # those of a maintenance branch created while main is still on that major. main_major=$(git show origin/main:packages/ckeditor5-common/package.json | jq -r .version | cut -d. -f1) if [ "$major" = "$main_major" ]; then dist_tag=snapshot diff --git a/scripts/major-changesets.mjs b/scripts/major-changesets.mjs new file mode 100644 index 0000000000..e85bce0d6d --- /dev/null +++ b/scripts/major-changesets.mjs @@ -0,0 +1,26 @@ +#!/usr/bin/env node +/** + * Prints the pending changesets that request a major bump, one per line, as paths + * relative to the repository root. + * + * Changesets are read by Changesets itself, so every valid frontmatter is recognized + * (quotes, comments, …) and an unparsable changeset fails. + * + * Usage: node scripts/major-changesets.mjs + */ +import { createRequire } from "node:module"; +import path from "node:path"; +import { pathToFileURL } from "node:url"; + +const rootDir = path.join(import.meta.dirname, ".."); + +// @changesets/read is a dependency of @changesets/cli, not of this workspace. +const cliPackageJson = createRequire(path.join(rootDir, "package.json")).resolve("@changesets/cli/package.json"); +const readModule = createRequire(cliPackageJson).resolve("@changesets/read"); +const { readChangesets } = await import(pathToFileURL(readModule).href); + +for (const { id, releases } of await readChangesets(rootDir)) { + if (releases.some(({ type }) => type === "major")) { + console.log(`.changeset/${id}.md`); + } +} From fed60e950cffb6c7586bb0be70f0c5c47eece6ce Mon Sep 17 00:00:00 2001 From: Jens Meisner Date: Mon, 16 Nov 2026 10:45:04 +0100 Subject: [PATCH 5/6] ci: Clarify maintenance checks and skip releases of released versions - checks action: on a maintenance branch, a package version of another major now reports the version and its likely causes (a major bump or a change based on another major) instead of the branch naming scheme. - create-maintenance-branch.yml: no longer drops pending changesets. A release tag never has any, since releases only happen without them. - release-and-publish.yml: skip the release when the version is already tagged. Creating a maintenance branch no longer runs a full build and all checks just to publish nothing. - DEVELOPMENT.md: a maintenance branch can only be created from a release that contains the Create Maintenance Branch workflow. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .github/actions/checks/action.yml | 6 +++--- .github/workflows/create-maintenance-branch.yml | 4 +--- .github/workflows/release-and-publish.yml | 11 ++++++++--- DEVELOPMENT.md | 7 ++++--- 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/.github/actions/checks/action.yml b/.github/actions/checks/action.yml index fbb51ff359..b05d48b6df 100644 --- a/.github/actions/checks/action.yml +++ b/.github/actions/checks/action.yml @@ -56,9 +56,9 @@ runs: TARGET_BRANCH: ${{ inputs.target-branch }} run: | BRANCH_MAJOR="${TARGET_BRANCH#maintenance/}" - VERSION_MAJOR=$(jq -r .version packages/ckeditor5-common/package.json | cut -d. -f1) - if [ "$VERSION_MAJOR" != "$BRANCH_MAJOR" ]; then - echo "::error::$TARGET_BRANCH holds version $VERSION_MAJOR.x.x; maintenance branches are named maintenance/." + VERSION=$(jq -r .version packages/ckeditor5-common/package.json) + if [ "${VERSION%%.*}" != "$BRANCH_MAJOR" ]; then + echo "::error::$TARGET_BRANCH only releases $BRANCH_MAJOR.x.y, but the packages have version $VERSION. A maintenance branch accepts neither major bumps nor changes based on another major." exit 1 fi diff --git a/.github/workflows/create-maintenance-branch.yml b/.github/workflows/create-maintenance-branch.yml index 3486239f43..11e884730b 100644 --- a/.github/workflows/create-maintenance-branch.yml +++ b/.github/workflows/create-maintenance-branch.yml @@ -89,10 +89,8 @@ jobs: jq --indent 2 --arg branch "$BRANCH" '.baseBranch = $branch' .changeset/config.json \ > "$RUNNER_TEMP/config.json" mv "$RUNNER_TEMP/config.json" .changeset/config.json - # Changesets pending at the release tag belong to main's next release. - find .changeset -maxdepth 1 -name '*.md' ! -name 'README.md' -delete - git add -A .changeset + git add .changeset/config.json git commit -m "ci: Create $BRANCH from $TAG" git push origin "$BRANCH" diff --git a/.github/workflows/release-and-publish.yml b/.github/workflows/release-and-publish.yml index 719b1dc3f3..8c926d6666 100644 --- a/.github/workflows/release-and-publish.yml +++ b/.github/workflows/release-and-publish.yml @@ -35,10 +35,15 @@ jobs: # "changeset version" consumed them are the packages ready to be published. COUNT=$(find .changeset -maxdepth 1 -name '*.md' ! -name 'README.md' | wc -l) echo "Pending changesets: $COUNT" - if [ "$COUNT" -eq 0 ]; then - echo "should-release=true" >> $GITHUB_OUTPUT - else + VERSION=$(jq -r .version packages/ckeditor5-common/package.json) + if [ "$COUNT" -ne 0 ]; then echo "should-release=false" >> $GITHUB_OUTPUT + # Nothing to publish without a new version, e.g. when maintenance/ is created. + elif git ls-remote --exit-code --tags origin "refs/tags/$VERSION" > /dev/null; then + echo "$VERSION is already released." + echo "should-release=false" >> $GITHUB_OUTPUT + else + echo "should-release=true" >> $GITHUB_OUTPUT fi release: diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index e5eec846eb..15f29a50d9 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -82,9 +82,10 @@ failed release). `main` must then not release that major again: its "Version Packages" pull request and its release fail until a `major` changeset is pending. -Only releases made with Changesets can be used as starting point. Releases of the -old release process (up to `28.1.1`) and the legacy branches `maintenance/23.0`, -`24.0` and `25.0` are not supported by this workflow. +The branch can only be created from a release that already contains the workflow +_Create Maintenance Branch_, i.e. a release made with Changesets after it was +introduced. Releases of the old release process (up to `28.1.1`) and the legacy +branches `maintenance/23.0`, `24.0` and `25.0` are not supported by this workflow. ## Update Process From dcadfa3944e477583adbcf3d632f689ba2b23d25 Mon Sep 17 00:00:00 2001 From: Jens Meisner Date: Mon, 16 Nov 2026 14:19:15 +0100 Subject: [PATCH 6/6] ci: Surface maintenance branch effects on main early After maintenance/ was cut from main's current major, pull requests with patch or minor changesets still passed on main. The problem only showed on the "Version Packages" pull request or the release. Changes merged into main but not yet released were silently left out of the new branch. - checks action: on main, warn when maintenance/ exists, the version is released and no major changeset is pending. The step still passes, so the pull request adding the major changeset can be integrated. An unreleased version still fails. The major changeset check now also runs in CI on main. - create-maintenance-branch.yml: when main is still on the requested major, list main's unreleased changesets as a warning and in the summary, so they can be cherry-picked. Changesets without package bumps are ignored. - create-or-update-release-pr.yml: title and commit message name the release line, e.g. "Version Packages (maintenance/30)". - scripts/major-changesets.mjs: import @changesets/read as a direct dev dependency instead of resolving it through @changesets/cli. - DEVELOPMENT.md: workflow fixes on main do not reach maintenance branches, unreleased changes on main are not part of a new branch, and major 28 becomes maintainable with its first Changesets release. --- .github/actions/checks/action.yml | 18 ++++++++++-------- .../workflows/create-maintenance-branch.yml | 18 ++++++++++++++++++ .../workflows/create-or-update-release-pr.yml | 2 ++ DEVELOPMENT.md | 13 +++++++++++-- package.json | 1 + pnpm-lock.yaml | 6 ++++++ pnpm-workspace.yaml | 1 + scripts/major-changesets.mjs | 8 +------- 8 files changed, 50 insertions(+), 17 deletions(-) diff --git a/.github/actions/checks/action.yml b/.github/actions/checks/action.yml index b05d48b6df..03d5eed2b7 100644 --- a/.github/actions/checks/action.yml +++ b/.github/actions/checks/action.yml @@ -71,10 +71,12 @@ runs: echo "No major changesets on $TARGET_BRANCH." # Counterpart on main: once maintenance/ exists (it may be created while main is - # still on that major), main must not release that major again. Only an unreleased - # version is checked: the "Version Packages" PR and the release itself, but also main - # after a failed release. A pending major changeset makes the next release major, so it - # passes; otherwise the pull request adding it could never be integrated. + # still on that major), main must not release that major again. An unreleased version + # fails: the "Version Packages" PR and the release itself, but also main after a failed + # release. A released version only warns, so patch and minor pull requests learn early + # that they will not be released before the next major. A pending major changeset makes + # the next release major, so it passes; otherwise the pull request adding it could + # never be integrated. - name: Check main release line id: main-line-check if: ${{ inputs.target-branch == 'main' }} @@ -82,10 +84,6 @@ runs: shell: bash run: | VERSION=$(jq -r .version packages/ckeditor5-common/package.json) - if git rev-parse -q --verify "refs/tags/$VERSION" > /dev/null; then - echo "$VERSION is already released; nothing to check." - exit 0 - fi MAJOR="${VERSION%%.*}" if ! git ls-remote --exit-code --heads origin "maintenance/$MAJOR" > /dev/null; then echo "main may release $VERSION." @@ -97,6 +95,10 @@ runs: echo "$MAJOR_CHANGESETS" exit 0 fi + if git rev-parse -q --verify "refs/tags/$VERSION" > /dev/null; then + echo "::warning::maintenance/$MAJOR exists, so main's next release must be major. Changes merged into main are not released until a 'major' changeset is added; fixes for $MAJOR.x.y go to maintenance/$MAJOR." + exit 0 + fi echo "::error::maintenance/$MAJOR exists, so main must not release $VERSION: its next release must be major. Add a 'major' changeset on main." exit 1 diff --git a/.github/workflows/create-maintenance-branch.yml b/.github/workflows/create-maintenance-branch.yml index 11e884730b..5dbcbd4b76 100644 --- a/.github/workflows/create-maintenance-branch.yml +++ b/.github/workflows/create-maintenance-branch.yml @@ -61,6 +61,20 @@ jobs: if [ "$MAIN_MAJOR" -eq "$MAJOR" ]; then git rev-parse -q --verify "refs/tags/$MAIN_VERSION" > /dev/null \ || fail "main holds the unreleased version $MAIN_VERSION; release it first." + + # Changes merged into main but not yet released are not part of the branch. + # Empty changesets (no package bumps) release nothing, so they are ignored. + PENDING="" + for FILE in .changeset/*.md; do + [ "$FILE" = .changeset/README.md ] && continue + awk '/^---[[:space:]]*$/ { n++; next } n == 1 && !/^[[:space:]]*(#.*)?$/ { found = 1 } END { exit !found }' "$FILE" \ + && PENDING+="$FILE"$'\n' + done + if [ -n "$PENDING" ]; then + echo "::warning::main has unreleased changes that are not part of $BRANCH; cherry-pick them including their changesets if $MAJOR.x.y needs them:" + echo -n "$PENDING" + echo -n "$PENDING" > "$RUNNER_TEMP/pending-changesets.txt" + fi fi TAG=$(git tag --list "$MAJOR.*" | grep -E "^$MAJOR\.[0-9]+\.[0-9]+$" | sort -V | tail -n 1 || true) @@ -109,5 +123,9 @@ jobs: if [ "$MAIN_MAJOR" = "$MAJOR" ]; then echo "- main is still on major $MAJOR: its next release must be major. Its \"Version Packages\" pull request fails until a \`major\` changeset is pending on main." fi + if [ -s "$RUNNER_TEMP/pending-changesets.txt" ]; then + echo "- ⚠️ main has unreleased changes that are not part of $BRANCH. Cherry-pick them, including their changesets, if $MAJOR.x.y needs them:" + sed 's/.*/ - `&`/' "$RUNNER_TEMP/pending-changesets.txt" + fi echo "- Dependabot only updates main: add an entry with \`target-branch: $BRANCH\` to \`.github/dependabot.yml\` on main if this line should get action updates." } >> "$GITHUB_STEP_SUMMARY" diff --git a/.github/workflows/create-or-update-release-pr.yml b/.github/workflows/create-or-update-release-pr.yml index 16ccf47ea9..eb670dd012 100644 --- a/.github/workflows/create-or-update-release-pr.yml +++ b/.github/workflows/create-or-update-release-pr.yml @@ -47,4 +47,6 @@ jobs: version-script: pnpm ci:version # One "Version Packages" PR per release line (branch changeset-release/). pr-base-branch: ${{ github.ref_name }} + pr-title: Version Packages (${{ github.ref_name }}) + commit-message: Version Packages (${{ github.ref_name }}) github-token: ${{ secrets.GH_PAT_PUSH_FROM_GHA }} diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 15f29a50d9..0d6e58a32f 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -66,6 +66,12 @@ A fix needed on both lines is made on one branch and cherry-picked to the other, including its changeset. `main` and maintenance branches are never merged into each other. +A maintenance branch keeps the GitHub Actions workflows of the release it was +created from. Fixes of the workflows on `main` do not reach it: cherry-pick them if +the branch needs them. Likewise, Dependabot only updates `main`; add an entry with +`target-branch: maintenance/` to `.github/dependabot.yml` on `main` if a +branch should get action updates. + **Example:** 1. `main` is released up to `30.4.2`; a CMCC version is bound to major 30. @@ -78,14 +84,17 @@ other. The branch may also be created while `main` is still on that major, e.g. right before breaking changes, as long as `main` has no unreleased version (e.g. after a -failed release). `main` must then not release that major again: its +failed release). Changes merged into `main` with changesets that are not released +yet are not part of the branch: release them first or cherry-pick them; the +workflow lists them. `main` must then not release that major again: its "Version Packages" pull request and its release fail until a `major` changeset is -pending. +pending, and pull requests into `main` get a warning until then. The branch can only be created from a release that already contains the workflow _Create Maintenance Branch_, i.e. a release made with Changesets after it was introduced. Releases of the old release process (up to `28.1.1`) and the legacy branches `maintenance/23.0`, `24.0` and `25.0` are not supported by this workflow. +Major 28 becomes maintainable with its first release made with Changesets. ## Update Process diff --git a/package.json b/package.json index c99bb8aab9..9ffb38587d 100644 --- a/package.json +++ b/package.json @@ -50,6 +50,7 @@ }, "devDependencies": { "@changesets/cli": "catalog:", + "@changesets/read": "catalog:", "@coremedia/studio-client.eslint-config": "catalog:", "eslint": "catalog:", "rimraf": "catalog:", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0afbe0b2ab..053d9e335b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -30,6 +30,9 @@ catalogs: '@changesets/cli': specifier: ^3.0.3 version: 3.0.3 + '@changesets/read': + specifier: ^1.0.1 + version: 1.0.1 '@ckeditor/ckeditor5-inspector': specifier: ^5.0.3 version: 5.0.3 @@ -171,6 +174,9 @@ importers: '@changesets/cli': specifier: 'catalog:' version: 3.0.3 + '@changesets/read': + specifier: 'catalog:' + version: 1.0.1 '@coremedia/studio-client.eslint-config': specifier: 'catalog:' version: 2.0.0(@types/eslint@9.6.1)(@typescript-eslint/utils@8.67.0(eslint@10.9.1(jiti@1.21.6)(supports-color@8.1.1))(supports-color@8.1.1)(typescript@6.0.3))(eslint-import-resolver-node@0.3.9(supports-color@8.1.1))(eslint@10.9.1(jiti@1.21.6)(supports-color@8.1.1))(supports-color@8.1.1)(typescript@6.0.3) diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 8244719221..43fbdde596 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -15,6 +15,7 @@ catalog: '@bbob/preset-html5': 4.3.1 '@bbob/types': 4.3.1 '@changesets/cli': ^3.0.3 + '@changesets/read': ^1.0.1 '@ckeditor/ckeditor5-inspector': ^5.0.3 '@coremedia-internal/studio-client.playwright-config': ^1.4.0 '@coremedia-internal/studio-client.storybook-config': ^2.0.1 diff --git a/scripts/major-changesets.mjs b/scripts/major-changesets.mjs index e85bce0d6d..f0d40bdc01 100644 --- a/scripts/major-changesets.mjs +++ b/scripts/major-changesets.mjs @@ -8,17 +8,11 @@ * * Usage: node scripts/major-changesets.mjs */ -import { createRequire } from "node:module"; import path from "node:path"; -import { pathToFileURL } from "node:url"; +import { readChangesets } from "@changesets/read"; const rootDir = path.join(import.meta.dirname, ".."); -// @changesets/read is a dependency of @changesets/cli, not of this workspace. -const cliPackageJson = createRequire(path.join(rootDir, "package.json")).resolve("@changesets/cli/package.json"); -const readModule = createRequire(cliPackageJson).resolve("@changesets/read"); -const { readChangesets } = await import(pathToFileURL(readModule).href); - for (const { id, releases } of await readChangesets(rootDir)) { if (releases.some(({ type }) => type === "major")) { console.log(`.changeset/${id}.md`);