Skip to content

Publish

Publish #4

Workflow file for this run

name: Publish
on:
workflow_dispatch:
inputs:
jsr:
type: boolean
default: true
description: publish to JSR
npm:
description: publish to npm
type: boolean
default: true
workflow_call:
inputs:
jsr:
type: boolean
default: true
npm:
type: boolean
default: true
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
env:
PARCEL_WORKER_BACKEND: process
steps:
- name: Checkout repository
if: ${{ inputs.jsr || inputs.npm }}
uses: actions/checkout@v4
- name: Setup Bun
if: ${{ inputs.jsr || inputs.npm }}
uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- name: Cache Bun dependencies
if: ${{ inputs.jsr || inputs.npm }}
uses: actions/cache@v4
with:
path: |
.bun
node_modules
key: ${{ runner.os }}-bun-${{ hashFiles('bun.lockb') }}
- name: Install dependencies and build
if: ${{ inputs.jsr || inputs.npm }}
run: |
bun install
bun run build
- name: Publish to JSR
if: ${{ inputs.jsr }}
run: bunx jsr publish --allow-dirty
- name: Setup npm registry
if: ${{ inputs.npm }}
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_AUTH_TOKEN }}" > ~/.npmrc
- name: Publish to npm
if: ${{ inputs.npm }}
run: bun run --bun npm publish --provenance --access public