Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Publish

on:
workflow_dispatch:

jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 10.12.4

- name: Use Node.js 22
uses: actions/setup-node@v4
with:
node-version: 22
cache: pnpm
registry-url: https://registry.npmjs.org

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Publish current main release
run: pnpm release
7 changes: 2 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@ on:
push:
branches:
- main
workflow_dispatch:

jobs:
release:
release_pr:
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
pull-requests: write

steps:
Expand All @@ -35,11 +33,10 @@ jobs:
- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Create release PR or publish to npm
- name: Create or update release PR
uses: changesets/action@v1
with:
version: pnpm version-packages
publish: pnpm release
title: "[-]: version packages"
commit: "[-]: version packages"
env:
Expand Down
12 changes: 9 additions & 3 deletions docs/releasing.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ After that, the GitHub release workflow can publish without storing a long-lived
2. Add a changeset before opening or updating the PR.
3. Merge the PR into `main`.
4. Let the Release workflow open or update the version PR.
5. Merge the version PR to publish the new npm version and update `CHANGELOG.md`.
5. Merge the version PR to update `CHANGELOG.md` and package versions on `main`.
6. Run the `Publish` workflow manually when you want to ship that version to npm.

## Adding a changeset

Expand Down Expand Up @@ -68,10 +69,15 @@ The normal path should be the GitHub Release workflow instead of local publishin

## What the release workflow does

On pushes to `main` or manual dispatch, `.github/workflows/release.yml` runs `changesets/action`.
On pushes to `main`, `.github/workflows/release.yml` runs `changesets/action`.

- If unreleased changesets exist, it opens or updates a release PR.
- If the release PR has already been merged and version files are on `main`, it runs `pnpm release`.
- It does not publish to npm.

## What the publish workflow does

Run `.github/workflows/publish.yml` manually when you want to ship the current version on `main`.

- `pnpm release` verifies tests, docs lint/build, size limits, and then runs `changeset publish`.
- Publishing uses GitHub Actions OIDC via npm Trusted Publishing instead of an `NPM_TOKEN` secret.

Expand Down
Loading