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
21 changes: 16 additions & 5 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,19 @@ name: Release
on:
push:
branches: [main]
workflow_dispatch:
inputs:
publish:
description: Publish the current package version to npm
required: true
default: false
type: boolean

permissions:
contents: write
issues: write
pull-requests: write
id-token: write

jobs:
release-please:
Expand All @@ -16,6 +24,7 @@ jobs:
steps:
- name: Create release PR or GitHub release
id: release
if: ${{ github.event_name == 'push' }}
uses: googleapis/release-please-action@v5
with:
# Use a PAT to make the release PR trigger the normal pull_request CI.
Expand All @@ -24,27 +33,29 @@ jobs:
manifest-file: .release-please-manifest.json

- name: Checkout repository
if: ${{ steps.release.outputs.release_created }}
if: ${{ steps.release.outputs.release_created || (github.event_name == 'workflow_dispatch' && inputs.publish) }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Recovery Publishes Selected Ref

A manual dispatch checks out whichever branch or tag the operator selects, while the skipped Release Please step provides no release commit to bind the run to. Selecting a feature branch or older tag with publish=true can therefore publish that ref's package contents instead of the contents of the existing GitHub release being recovered.

uses: actions/checkout@v7
Comment on lines +36 to 37

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Recovery Publishes Selected Branch

On a manual recovery, checkout uses the branch selected in the workflow UI rather than the tag for the failed release. If main has advanced before recovery, pnpm publish reads its current version and files, so the workflow can publish a different package or fail while leaving the intended release unpublished.


- name: Setup pnpm
if: ${{ steps.release.outputs.release_created }}
if: ${{ steps.release.outputs.release_created || (github.event_name == 'workflow_dispatch' && inputs.publish) }}
uses: pnpm/action-setup@v6

- name: Setup Node.js 24
if: ${{ steps.release.outputs.release_created }}
if: ${{ steps.release.outputs.release_created || (github.event_name == 'workflow_dispatch' && inputs.publish) }}
uses: actions/setup-node@v7
with:
node-version: 24
cache: pnpm
registry-url: https://registry.npmjs.org

- name: Install dependencies
if: ${{ steps.release.outputs.release_created }}
if: ${{ steps.release.outputs.release_created || (github.event_name == 'workflow_dispatch' && inputs.publish) }}
run: pnpm install --frozen-lockfile

- name: Publish package to npm
if: ${{ steps.release.outputs.release_created }}
if: ${{ steps.release.outputs.release_created || (github.event_name == 'workflow_dispatch' && inputs.publish) }}
run: pnpm publish --no-git-checks
env:
# Trusted Publishing uses the workflow's id-token permission. NPM_TOKEN
# remains available as a fallback for token-based npm authentication.
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Empty Fallback Can Override OIDC

When NPM_TOKEN is not configured, this still exports NODE_AUTH_TOKEN as an empty value while setup-node has configured registry authentication around that variable. If pnpm treats the resulting token configuration as explicit authentication, it attempts an unauthenticated publish instead of Trusted Publishing, reproducing the recovery failure despite id-token: write; only set this environment variable when the fallback secret exists.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ pnpm test:integration # Network/ffmpeg integration tests

### Releases

Releases are automated with [Release Please](https://github.com/googleapis/release-please). Merging its release PR updates the package version and changelog, creates the GitHub release, and publishes the package to npm. The repository requires an `NPM_TOKEN` secret; a `RELEASE_PLEASE_TOKEN` secret is recommended so release PRs run the regular pull-request CI.
Releases are automated with [Release Please](https://github.com/googleapis/release-please). Merging its release PR updates the package version and changelog, creates the GitHub release, and publishes the package to npm. The recommended setup is [npm Trusted Publishing](https://docs.npmjs.com/trusted-publishers/) for the `release-please.yml` workflow; an `NPM_TOKEN` repository secret remains supported as a fallback. A `RELEASE_PLEASE_TOKEN` secret is recommended so release PRs run the regular pull-request CI. To recover a release after configuring npm authentication, run the `Release` workflow manually with `publish` set to `true`.

### Adding a New Platform

Expand Down