Files
Parker BrownandCopilot App f3a828e4b9 ci: create signed dist commits in release workflow (#404)
The `main` ruleset requires verified signatures, but the "chore: update
dist files" commit on release-please PRs isn't signed.
`git-auto-commit-action` creates it with plain `git push`. [Unsigned
commits on the head branch can block squash merges
too](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-rulesets/available-rules-for-rulesets#require-signed-commits),
so the dist commit itself needs a signature.

This replaces `git-auto-commit-action` with
[`dsanders11/github-app-commit-action`](https://github.com/dsanders11/github-app-commit-action),
pinned to the v2.1.0 commit SHA. It creates the commit through the REST
Git Data API with the releaser app token, and GitHub signs commits that
a GitHub App creates that way.

- A new `git add dist` step stages the rebuilt files. The action commits
only staged changes, so this replaces `file_pattern: dist/**`.
- `commit_author` is removed. GitHub signs API commits only when they
don't set a custom author, so the commit is now authored by the releaser
app instead of `github.actor`.
- `fail-on-no-changes: false` keeps the old behavior of skipping the
commit when dist didn't change.

The action uploads files as blobs, so the roughly 900 KB bundles aren't
a problem. The releaser app token is still needed: if the commit used
`GITHUB_TOKEN`, `test` wouldn't run on release PRs.

The first release run after merging will confirm the commit shows as
verified.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: c91009d9-b4f7-4eec-b30f-4b24ae578aa1
2026-10-12 16:40:31 -07:00

85 lines
2.9 KiB
YAML

name: release
on:
workflow_dispatch:
push:
branches:
- "*.x"
- main
- beta
permissions:
contents: write
issues: write
pull-requests: write
jobs:
release:
name: release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: ./
id: app-token
with:
app-id: ${{ vars.RELEASER_APP_ID }}
private-key: ${{ secrets.RELEASER_APP_PRIVATE_KEY }}
- uses: googleapis/release-please-action@45996ed1f6d02564a971a2fa1b5860e934307cf7 # v5.0.0
id: release-please
with:
token: ${{ steps.app-token.outputs.token }}
config-file: ${{ github.ref_name == 'beta' && 'release-please-config.beta.json' || 'release-please-config.json' }}
manifest-file: .release-please-manifest.json
target-branch: ${{ github.ref_name }}
- uses: actions/checkout@v7
if: steps.release-please.outputs.prs_created == 'true'
with:
ref: ${{ fromJSON(steps.release-please.outputs.pr).headBranchName }}
token: ${{ steps.app-token.outputs.token }}
- uses: actions/setup-node@v6
if: steps.release-please.outputs.prs_created == 'true'
with:
node-version-file: package.json
- run: npm ci
if: steps.release-please.outputs.prs_created == 'true'
- run: npm run build
if: steps.release-please.outputs.prs_created == 'true'
- run: git add dist
if: steps.release-please.outputs.prs_created == 'true'
- uses: dsanders11/github-app-commit-action@2bbcd331016d8c950b05a24b56e7eb9cb50d545e # v2.1.0
if: steps.release-please.outputs.prs_created == 'true'
with:
message: "chore: update dist files"
token: ${{ steps.app-token.outputs.token }}
fail-on-no-changes: false
- name: Update major version tag
id: update-major-tag
if: steps.release-please.outputs.release_created == 'true' && github.ref_name != 'beta'
uses: octokit/request-action@b91aabaa861c777dcdb14e2387e30eddf04619ae # v3.0.0
continue-on-error: true
with:
route: PATCH /repos/${{ github.repository }}/git/refs/tags/v${{ steps.release-please.outputs.major }}
sha: ${{ steps.release-please.outputs.sha }}
force: true
env:
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
- name: Create major version tag
if: steps.release-please.outputs.release_created == 'true' && github.ref_name != 'beta' && steps.update-major-tag.outcome == 'failure'
uses: octokit/request-action@b91aabaa861c777dcdb14e2387e30eddf04619ae # v3.0.0
with:
route: POST /repos/${{ github.repository }}/git/refs
ref: refs/tags/v${{ steps.release-please.outputs.major }}
sha: ${{ steps.release-please.outputs.sha }}
env:
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}