diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f7fbb116..e229b791 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -54,19 +54,8 @@ jobs: github-token: ${{ secrets.GITHUB_TOKEN }} # Mutually exclusive with tagging: update the existing version PR, not main. - - name: Sync README on Version Packages PR - if: steps.changesets.outputs['has-changesets'] == 'true' - run: | - git fetch origin changeset-release/main - git checkout -B changeset-release/main origin/changeset-release/main - yarn readme - if ! git diff --quiet -- README.md; then - git config user.name 'github-actions[bot]' - git config user.email '41898282+github-actions[bot]@users.noreply.github.com' - git add README.md - git commit -m 'docs: sync generated README' - git push origin HEAD:changeset-release/main - fi + # The README is regenerated by the version-packages script, so the + # Version Packages PR commit includes it alongside the version bumps. # Only the merged version commit has no pending changesets. - name: Tag released versions diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9c33e012..d789cf1c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -37,7 +37,7 @@ After `yarn install`, the `prepare` script runs `husky` and sets `core.hooksPath | **pre-commit** | `yarn lint-staged` — format + lint staged files; package tests for staged `codemods/**/scripts/*` ([`.lintstagedrc.json`](./.lintstagedrc.json)) | | **pre-push** | `yarn check:changed` (the `check-changed` bin from [`@backstage/scripts`](./packages/scripts)) — the **same** format / lint / package-name / test gates as CI | -CI (`.github/workflows/ci.yml`) calls that same script, so local and remote gates cannot drift. Run `yarn check:changed` anytime to reproduce CI locally. Codemod PRs do not regenerate or check the root README; leave it unchanged. After codemods land on `main` with changesets, the release workflow regenerates the README on the **Version Packages** PR, so changeset consumption, version bumps, and the README update always land together. There is no separate README-sync workflow: if the README drifts without a changeset, regenerate it on the next release PR, or run `yarn readme` locally and commit the result through a normal PR. +CI (`.github/workflows/ci.yml`) calls that same script, so local and remote gates cannot drift. Run `yarn check:changed` anytime to reproduce CI locally. Codemod PRs do not regenerate or check the root README; leave it unchanged. After codemods land on `main` with changesets, the release workflow's `version-packages` script (`changeset version && sync-codemod-versions && generate-readme-codemods`) regenerates the README as part of the same version commit, so changeset consumption, version bumps, and the README update always land together on the **Version Packages** PR. There is no separate README-sync workflow: if the README drifts without a changeset, regenerate it on the next release PR, or run `yarn readme` locally and commit the result through a normal PR. ## Making changes diff --git a/package.json b/package.json index f05d1717..987c2981 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "lint:fix": "oxlint --type-aware --type-check --fix --no-error-on-unmatched-pattern --ignore-pattern .worktrees", "prepare": "husky", "changeset": "changeset", - "version-packages": "changeset version && sync-codemod-versions", + "version-packages": "changeset version && sync-codemod-versions && generate-readme-codemods", "readme": "generate-readme-codemods", "check:changed": "check-changed", "tag-and-publish": "tag-and-publish" diff --git a/packages/scripts/tests/wiring.test.ts b/packages/scripts/tests/wiring.test.ts index ad79cc1e..407d26c0 100644 --- a/packages/scripts/tests/wiring.test.ts +++ b/packages/scripts/tests/wiring.test.ts @@ -26,7 +26,7 @@ test('release workflow calls the bins', () => { test('root package.json scripts and devDependency use the bins', () => { const manifest = JSON.parse(read('package.json')) as { scripts: Record; devDependencies: Record } - assert.equal(manifest.scripts['version-packages'], 'changeset version && sync-codemod-versions') + assert.equal(manifest.scripts['version-packages'], 'changeset version && sync-codemod-versions && generate-readme-codemods') assert.equal(manifest.scripts['readme'], 'generate-readme-codemods') assert.equal(manifest.scripts['check:changed'], 'check-changed') assert.ok(manifest.devDependencies['@backstage/scripts'] !== undefined)