Skip to content

Release Please

Release Please #20

name: Release Please
on:
push:
branches:
- main
workflow_dispatch:
inputs:
ref:
description: Git tag to publish (e.g. v0.3.0) when re-running a release
required: true
permissions:
contents: write
pull-requests: write
jobs:
release-please:
runs-on: ubuntu-latest
outputs:
release_created: ${{ steps.release.outputs.release_created }}
tag_name: ${{ steps.release.outputs.tag_name }}
steps:
- uses: actions/create-github-app-token@v2
id: app-token
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.PRIVATE_KEY }}
- uses: googleapis/release-please-action@v4
id: release
with:
token: ${{ steps.app-token.outputs.token }}
config-file: release-please-config.json
manifest-file: .release-please-manifest.json
npm-publish:
needs: release-please
# Publish on a fresh release, or manually for a given tag via workflow_dispatch.
if: ${{ needs.release-please.outputs.release_created || github.event_name == 'workflow_dispatch' }}
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write # required for npm provenance (OIDC)
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.ref || github.ref }}
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: 22
registry-url: https://registry.npmjs.org
- name: Cache Bun dependencies
uses: actions/cache@v4
with:
path: ~/.bun/install/cache
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lockb') }}
restore-keys: |
${{ runner.os }}-bun-
- name: Install dependencies
run: bun install
- name: Build
run: bun run build
# bun publish does not support npm provenance; build the tarball with bun
# and publish it via npm with --provenance (id-token: write enables OIDC).
- name: Pack tarball
run: bun pm pack
- name: Publish to npm (with provenance)
run: npm publish ./*.tgz --provenance --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}