diff --git a/.github/workflows/prepare-release.yaml b/.github/workflows/prepare-release.yaml new file mode 100644 index 0000000..3b64935 --- /dev/null +++ b/.github/workflows/prepare-release.yaml @@ -0,0 +1,43 @@ +name: Prepare release + +on: + workflow_dispatch: + inputs: + bump: + description: Part of the version to bump + required: true + type: choice + options: + - patch + - minor + - major + +permissions: {} + +jobs: + prepare: + name: Prepare release + runs-on: ubuntu-26.04 + timeout-minutes: 5 + permissions: + contents: read + concurrency: + group: ${{ github.workflow }} + cancel-in-progress: false + steps: + - name: Checkout repository + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + + - name: Set up Node.js and pnpm and install dependencies + uses: pnpm/setup@703c52620218391530e48b9e8870d5c0082e1b9b # v2.1.0 + with: + cache: true + runtime: node + require-lockfile: true + + - name: Open the release pull request + uses: dnd-mapp/action-prepare-release@b316f1698ace141b667c3a6f6949937da48fbe17 # v1.1.0 + with: + bump: ${{ inputs.bump }} + client-id: ${{ vars.GH_APP_CLIENT_ID }} + private-key: ${{ secrets.GH_APP_PRIVATE_KEY }} diff --git a/AGENTS.md b/AGENTS.md index 511189d..2808582 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -27,4 +27,4 @@ Turn on auto-merge for every pull request you open, so it merges as soon as it i - A draft cannot have auto-merge. Mark it ready with `gh pr ready ` first, then run the command above. - When the user asks to keep a pull request open, leave auto-merge off. If it is already on, turn it off with `gh pr merge --disable-auto`. -- Release pull requests (`chore: release X.Y.Z`) get auto-merge too. The release starts only when the maintainer pushes the `vX.Y.Z` tag on the merge commit by hand, as `CONTRIBUTING.md` describes. +- Release pull requests (`chore: release X.Y.Z`) come from the Prepare release workflow, which turns on auto-merge itself. Do not prepare a release commit by hand. The release starts only when the maintainer pushes the `vX.Y.Z` tag on the merge commit by hand, as `CONTRIBUTING.md` describes. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9060cb5..afdddbe 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -76,8 +76,8 @@ Enabling a stricter rule or lowering a limit can make commits that passed before ## Releasing -1. Open a pull request with a single `chore: release X.Y.Z` commit. It sets `version` in `package.json`, renames `[Unreleased]` to `[X.Y.Z] - YYYY-MM-DD`, adds a fresh `[Unreleased]`, and updates the link references. -2. Merge it, then create an annotated tag `vX.Y.Z` on the merge commit and push the tag. +1. Run the [prepare release workflow](.github/workflows/prepare-release.yaml) on `main` with the part of the version to bump, for example `gh workflow run prepare-release.yaml -f bump=minor`. It opens the `chore: release X.Y.Z` pull request with auto-merge on. +2. Review and approve the pull request. Once it merges, create an annotated tag `vX.Y.Z` on the merge commit and push the tag. 3. The [release workflow](.github/workflows/release.yaml) runs the CI checks, verifies the tag and the changelog, stages the package on npm, and creates the GitHub Release. 4. Find the staged version with `pnpm stage list` and approve it with `pnpm stage approve ` and 2FA.