Publish to NPM and JSR #19
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Publish to NPM and JSR | |
| # Trigger this workflow whenever a new release is published | |
| on: | |
| workflow_dispatch: | |
| push: | |
| tags: | |
| - 'v*' | |
| # Grant write permissions to the repository contents so we can push version updates | |
| permissions: | |
| contents: write | |
| env: | |
| CI: true | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| id-token: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version-file: ".bun-version" | |
| - name: Install dependencies | |
| run: bun i | |
| - name: Run tests | |
| run: bun test | |
| - name: Build | |
| run: bun run build | |
| - name: Publish to NPM | |
| run: bun publish --access public | |
| continue-on-error: true | |
| env: | |
| NPM_CONFIG_TOKEN: ${{ secrets.NPM_SECRET }} | |
| - name: Publish to JSR | |
| run: bunx jsr publish |