Repository navigation
v0.8.0 #376
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: Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write | |
| contents: write | |
| steps: | |
| - name: Check out | |
| uses: actions/checkout@v4 | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 9 | |
| run_install: false | |
| - name: Use Node.js 20.x | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20.x | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Check types | |
| run: pnpm checktype | |
| - name: Run tests | |
| run: pnpm test | |
| - name: Determine release tag | |
| id: release-tag | |
| run: | | |
| TAG=${GITHUB_REF#refs/tags/} | |
| echo "version=$TAG" >> $GITHUB_OUTPUT | |
| if [[ "$TAG" =~ -alpha(\.|$) ]] || [[ "$TAG" =~ -beta(\.|$) ]]; then | |
| echo "npm_tag=next" >> $GITHUB_OUTPUT | |
| echo "is_prerelease=true" >> $GITHUB_OUTPUT | |
| echo "📦 Publishing as pre-release: $TAG (npm tag: next)" | |
| else | |
| echo "npm_tag=latest" >> $GITHUB_OUTPUT | |
| echo "is_prerelease=false" >> $GITHUB_OUTPUT | |
| echo "📦 Publishing as stable release: $TAG (npm tag: latest)" | |
| fi | |
| - name: Build | |
| run: pnpm build && pnpm build:umd | |
| - name: Prepare package | |
| run: node scripts/purge-pkg-for-publish.mjs | |
| - name: Verify package contents | |
| run: npm pack --dry-run | |
| - name: Publish to npm | |
| run: npm publish --access public --no-git-checks --provenance --registry=https://registry.npmjs.org --tag=${{ steps.release-tag.outputs.npm_tag }} | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN_ELEVATED }} | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ steps.release-tag.outputs.version }} | |
| name: Release ${{ steps.release-tag.outputs.version }} | |
| draft: false | |
| prerelease: ${{ steps.release-tag.outputs.is_prerelease }} | |
| generate_release_notes: true |