From 870e5bbf7a190b1a2444fda3bdaa2a060694992e Mon Sep 17 00:00:00 2001 From: Jon Ayers Date: Wed, 18 Nov 2026 21:13:29 +0000 Subject: [PATCH] ci: update release workflow settings --- .github/workflows/publish.yml | 24 ++++++++++++++---------- docs/release.md | 8 ++++---- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 83eee19d..8975385e 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -23,6 +23,7 @@ jobs: publish-stable: name: publish stable packages runs-on: ubuntu-latest + environment: npm-release if: github.event_name == 'push' || github.event_name == 'workflow_dispatch' steps: - name: Resolve tag @@ -49,7 +50,7 @@ jobs: echo "npm_tag=$NPM_TAG" >> "$GITHUB_OUTPUT" - name: Checkout tag - uses: actions/checkout@v4 + uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0 with: ref: ${{ steps.tag.outputs.tag }} fetch-depth: 0 @@ -79,14 +80,15 @@ jobs: NODE - name: Setup Bun - uses: oven-sh/setup-bun@v1 + uses: oven-sh/setup-bun@f4d14e03ff726c06358e5557344e1da148b56cf7 # v1.2.2 with: - bun-version: latest + bun-version: 1.4.4 - name: Setup Zig uses: ./.github/actions/setup-zig with: version: 0.15.2 + cache: 'false' - name: Install dependencies run: bun install --frozen-lockfile @@ -116,13 +118,13 @@ jobs: fi - name: Setup Node.js for npm - uses: actions/setup-node@v4 + uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 with: node-version: '24.22.1' registry-url: 'https://registry.npmjs.org' - name: Ensure current npm for trusted publishing - run: npm install -g npm@latest + run: npm install -g npm@12.2.3 - name: Publish ghostty-web env: @@ -172,6 +174,7 @@ jobs: publish-next: name: publish next packages runs-on: ubuntu-latest + environment: npm-next # Only ci runs for a push to this repository publish next packages. if: >- github.event_name == 'workflow_run' && @@ -180,7 +183,7 @@ jobs: github.event.workflow_run.head_repository.full_name == github.repository steps: - name: Checkout CI head - uses: actions/checkout@v4 + uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0 with: ref: ${{ github.event.workflow_run.head_sha }} fetch-depth: 0 @@ -203,15 +206,16 @@ jobs: - name: Setup Bun if: steps.release-commit.outputs.skip != 'true' - uses: oven-sh/setup-bun@v1 + uses: oven-sh/setup-bun@f4d14e03ff726c06358e5557344e1da148b56cf7 # v1.2.2 with: - bun-version: latest + bun-version: 1.4.4 - name: Setup Zig if: steps.release-commit.outputs.skip != 'true' uses: ./.github/actions/setup-zig with: version: 0.15.2 + cache: 'false' - name: Install dependencies if: steps.release-commit.outputs.skip != 'true' @@ -223,14 +227,14 @@ jobs: - name: Setup Node.js for npm if: steps.release-commit.outputs.skip != 'true' - uses: actions/setup-node@v4 + uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 with: node-version: '24.22.1' registry-url: 'https://registry.npmjs.org' - name: Ensure current npm for trusted publishing if: steps.release-commit.outputs.skip != 'true' - run: npm install -g npm@latest + run: npm install -g npm@12.2.3 - name: Compute next version if: steps.release-commit.outputs.skip != 'true' diff --git a/docs/release.md b/docs/release.md index ff5650b3..1e308d48 100644 --- a/docs/release.md +++ b/docs/release.md @@ -7,11 +7,11 @@ 3. After changes land on `main`, `.github/workflows/release-please.yml` opens or updates one Release Please PR. 4. Merging the Release Please PR creates one `vX.Y.Z-rc.N` tag and a GitHub prerelease while this RC configuration is enabled. The first expected release candidate is `v0.5.0-rc.0`. 5. The Release Please workflow explicitly dispatches `.github/workflows/publish.yml` for the tag because workflows created with `GITHUB_TOKEN` do not reliably trigger follow-up workflows automatically. -6. `publish.yml` validates the tag and source versions, runs the release quality gates, publishes `ghostty-web`, then publishes `@ghostty-web/demo` with its `ghostty-web` dependency pinned to the exact release version. +6. `publish.yml` waits for a maintainer to approve the run in the `npm-release` environment, then validates the tag and source versions, runs the release quality gates, publishes `ghostty-web`, then publishes `@ghostty-web/demo` with its `ghostty-web` dependency pinned to the exact release version. ## Next publishes -`.github/workflows/publish.yml` also publishes `ghostty-web@next` and `@ghostty-web/demo@next` after successful CI on `main`. Release-only squash commits whose subject matches `chore(release): ...` are skipped so version/changelog-only release PR merges do not create noisy prereleases. +`.github/workflows/publish.yml` also publishes `ghostty-web@next` and `@ghostty-web/demo@next` after successful CI on `main`, from the `npm-next` environment. Release-only squash commits whose subject matches `chore(release): ...` are skipped so version/changelog-only release PR merges do not create noisy prereleases. Stable, release-candidate, and `next` publishing intentionally live in this single workflow file because npm trusted publishing is configured against a workflow identity. @@ -28,13 +28,13 @@ When the pipeline has been test-driven successfully and maintainers are ready fo ## Manual recovery - Rerun `Release Please` on `main` to recreate or update a release PR. -- Dispatch `publish.yml` manually with an existing `vX.Y.Z-rc.N` or `vX.Y.Z` tag to retry npm publishing. +- Dispatch `publish.yml` manually with an existing `vX.Y.Z-rc.N` or `vX.Y.Z` tag to retry npm publishing. The run needs the same approval. - Publish jobs are idempotent: if a package version already exists on npm, the workflow skips publishing and attempts to repair the matching dist-tag (`rc` for `0.5.0-rc.0`, `latest` for stable versions). ## Required admin setup Before the first automated stable release: -- Configure npm trusted publishers for both `ghostty-web` and `@ghostty-web/demo` for `.github/workflows/publish.yml`. +- Configure npm trusted publishers for both `ghostty-web` and `@ghostty-web/demo` for `.github/workflows/publish.yml`, one for each of the `npm-release` and `npm-next` environments. - Enable squash merging, disable merge commits and rebase merging, and set squash commit titles to use the pull request title. - Require the `pr-title`, `fmt`, `lint`, `type check`, `test`, and `build` checks before merge; require merge-group variants too if merge queue is enabled.