v0.1.31 #18
Workflow file for this run
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 | |
| on: | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: Package version to publish | |
| required: true | |
| permissions: | |
| contents: read | |
| id-token: write | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Setup Bun | |
| uses: oven-sh/setup-bun@v2 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: '24' | |
| registry-url: 'https://registry.npmjs.org' | |
| package-manager-cache: false | |
| - name: Install dependencies | |
| run: bun install --frozen-lockfile | |
| - name: Verify release version | |
| env: | |
| RELEASE_TAG: ${{ github.event.release.tag_name || inputs.version }} | |
| run: node -e "const actual=require('./package.json').version; const expected=process.env.RELEASE_TAG.replace(/^v/, ''); if(actual!==expected){throw new Error('package '+actual+' != release '+expected)}" | |
| - name: Test | |
| run: bun test | |
| - name: Typecheck | |
| run: bun run typecheck | |
| - name: Build | |
| run: bun run build | |
| - name: Publish to npm | |
| env: | |
| PACKAGE_VERSION: ${{ github.event.release.tag_name || inputs.version }} | |
| run: | | |
| if [[ "${PACKAGE_VERSION#v}" == *-* ]]; then | |
| npm publish --access public --tag next | |
| else | |
| npm publish --access public --tag latest | |
| fi |