|
| 1 | +name: Publish to bun |
| 2 | +permissions: {} |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - v* |
| 7 | +jobs: |
| 8 | + test: |
| 9 | + runs-on: ubuntu-latest |
| 10 | + permissions: |
| 11 | + contents: read |
| 12 | + steps: |
| 13 | + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 |
| 14 | + with: |
| 15 | + persist-credentials: false |
| 16 | + - name: Setup Bun |
| 17 | + uses: oven-sh/setup-bun@b7a1c7ccf290d58743029c4f6903da283811b979 # v2.1.0 |
| 18 | + with: |
| 19 | + bun-version: latest |
| 20 | + - name: Install dependencies |
| 21 | + run: bun ci --ignore-scripts |
| 22 | + - name: Run tests |
| 23 | + run: bun test |
| 24 | + build: |
| 25 | + runs-on: ubuntu-latest |
| 26 | + permissions: |
| 27 | + contents: read |
| 28 | + outputs: |
| 29 | + tarball: ${{ steps.pack.outputs.tarball }} |
| 30 | + steps: |
| 31 | + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 |
| 32 | + with: |
| 33 | + persist-credentials: false |
| 34 | + - name: Setup Bun |
| 35 | + uses: oven-sh/setup-bun@b7a1c7ccf290d58743029c4f6903da283811b979 # v2.1.0 |
| 36 | + with: |
| 37 | + bun-version: latest |
| 38 | + - name: Install dependencies |
| 39 | + run: bun ci --ignore-scripts |
| 40 | + - run: bun run build |
| 41 | + - run: bun version $TAG_NAME --git-tag-version=false |
| 42 | + env: |
| 43 | + TAG_NAME: ${{ github.ref_name }} |
| 44 | + - id: pack |
| 45 | + run: |- |
| 46 | + TARBALL=$(bun pack) |
| 47 | + echo "tarball=$TARBALL" >> $GITHUB_OUTPUT |
| 48 | + - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 |
| 49 | + with: |
| 50 | + name: tarball |
| 51 | + path: ${{ steps.pack.outputs.tarball }} |
| 52 | + publish: |
| 53 | + needs: |
| 54 | + - test |
| 55 | + - build |
| 56 | + runs-on: ubuntu-latest |
| 57 | + permissions: |
| 58 | + id-token: write |
| 59 | + env: |
| 60 | + TARBALL: ${{ needs.build.outputs.tarball }} |
| 61 | + steps: |
| 62 | + - uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0 |
| 63 | + with: |
| 64 | + name: tarball |
| 65 | + - uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0 |
| 66 | + with: |
| 67 | + node-version: 24 |
| 68 | + package-manager-cache: false |
| 69 | + - run: bun publish --provenance --access public --tag next $TARBALL |
| 70 | + if: github.event.release.prerelease |
| 71 | + env: |
| 72 | + TARBALL: ${{ needs.build.outputs.tarball }} |
| 73 | + - run: bun publish --provenance --access public $TARBALL |
| 74 | + if: "!github.event.release.prerelease" |
| 75 | + env: |
| 76 | + TARBALL: ${{ needs.build.outputs.tarball }} |
| 77 | + - name: Generate Change Log |
| 78 | + run: bunx changelogithub |
| 79 | + env: |
| 80 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments