Skip to content
Merged
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
19 changes: 7 additions & 12 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,19 @@ name: publish

on:
release:
types: [published]
push:
tags:
- "v*"
types: [published, created, prereleased, released]
workflow_dispatch:

permissions:
contents: read
id-token: write # required for JSR OIDC
id-token: write # required for OIDC

concurrency:
group: publish-${{ github.ref_name }}
cancel-in-progress: true

jobs:
publish:
if: github.repository_owner == 'bgub'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -32,6 +28,7 @@ jobs:
node-version: "20"
cache: "pnpm"
registry-url: "https://registry.npmjs.org"
npm-version: "11.6.0"

- run: pnpm install --frozen-lockfile
- run: pnpm build
Expand All @@ -40,17 +37,15 @@ jobs:
CI: true

# npm publish
- name: Publish to npm
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: publish to npm
run: |
VERSION=$(node -p "require('./package.json').version")
if [[ "$VERSION" == *-* ]]; then
pnpm publish --access public --provenance --tag next
npm publish --access public --provenance --tag next
else
pnpm publish --access public --provenance
npm publish --access public --provenance
fi

# JSR publish (OIDC, no secret needed once linked)
- name: Publish to JSR
- name: publish to JSR
run: pnpm dlx jsr publish