v4.0.0 #67
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: | |
| workflow_dispatch: | |
| push: | |
| tags: | |
| - 'v*.*.*' | |
| branches: | |
| - main | |
| permissions: | |
| id-token: write | |
| contents: write | |
| jobs: | |
| release: | |
| name: Release ${{ github.ref_name }} | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/') | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Verify tag is from main | |
| run: | | |
| git fetch origin main | |
| if ! git merge-base --is-ancestor ${{ github.sha }} origin/main; then | |
| echo "Tag was not created from main branch. Aborting." | |
| exit 1 | |
| fi | |
| - name: Cache dependencies | |
| uses: actions/cache@v5 | |
| with: | |
| path: '**/node_modules' | |
| key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lock') }} | |
| restore-keys: ${{ runner.os }}-bun- | |
| - name: Install Node.js # required for tsdown, see https://github.com/rolldown/tsdown/releases/tag/v0.22.0 | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 24 | |
| - name: Install Bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: latest | |
| - name: Install dependencies | |
| run: bun install --frozen-lockfile | |
| - name: Type check | |
| run: bun run typecheck | |
| - name: Run tests | |
| run: bun run test | |
| - name: Build | |
| run: bun run build | |
| - name: Publish to npm registry | |
| run: bunx npm@latest publish --access public | |
| - name: Publish GitHub release | |
| run: gh release create ${{ github.ref_name }} --generate-notes | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| canary: | |
| name: Canary Release | |
| runs-on: ubuntu-latest | |
| if: github.ref == 'refs/heads/main' | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Cache dependencies | |
| uses: actions/cache@v5 | |
| with: | |
| path: '**/node_modules' | |
| key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lock') }} | |
| restore-keys: ${{ runner.os }}-bun- | |
| - name: Install Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 24 | |
| - name: Install Bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: latest | |
| - name: Install dependencies | |
| run: bun install --frozen-lockfile | |
| - name: Type check | |
| run: bun run typecheck | |
| - name: Run tests | |
| run: bun run test | |
| - name: Build | |
| run: bun run build | |
| - name: Bump prerelease version | |
| run: | | |
| VERSION=$(bun pm pkg get version | tr -d '"') | |
| bun pm version $VERSION-canary.$(git rev-parse --short HEAD) --no-git-tag-version --allow-same-version | |
| - name: Publish to npm registry (canary) | |
| run: bunx npm@latest publish --access public --tag canary |