| 1 | name: Release Please |
| 2 | |
| 3 | on: |
| 4 | push: |
| 5 | branches: |
| 6 | - master |
| 7 | |
| 8 | permissions: |
| 9 | contents: read |
| 10 | |
| 11 | jobs: |
| 12 | release-please: |
| 13 | runs-on: ubuntu-latest |
| 14 | |
| 15 | permissions: |
| 16 | contents: write |
| 17 | pull-requests: write |
| 18 | |
| 19 | outputs: |
| 20 | release_created: ${{ steps.release.outputs.release_created }} |
| 21 | |
| 22 | steps: |
| 23 | - uses: googleapis/release-please-action@v4 |
| 24 | id: release |
| 25 | with: |
| 26 | token: ${{ secrets.WORKFLOW_TOKEN }} |
| 27 | config-file: .github/release-please/config.json |
| 28 | manifest-file: .github/release-please/manifest.json |
| 29 | |
| 30 | build-release: |
| 31 | needs: release-please |
| 32 | runs-on: ubuntu-latest |
| 33 | if: needs.release-please.outputs.release_created |
| 34 | |
| 35 | steps: |
| 36 | - name: Checkout |
| 37 | uses: actions/checkout@v4 |
| 38 | |
| 39 | - name: Setup pnpm |
| 40 | uses: pnpm/action-setup@v4 |
| 41 | |
| 42 | - name: Setup Node.js |
| 43 | uses: actions/setup-node@v4 |
| 44 | with: |
| 45 | node-version: 20.x |
| 46 | cache: 'pnpm' |
| 47 | |
| 48 | - name: Install Dependencies |
| 49 | run: pnpm install --ignore-scripts --frozen-lockfile |
| 50 | |
| 51 | - name: Tests & Coverage |
| 52 | run: | |
| 53 | pnpm test |
| 54 | pnpm coverage |
| 55 | |
| 56 | - name: Lint |
| 57 | run: pnpm lint |
| 58 | |
| 59 | - name: Production Build |
| 60 | run: pnpm build:prod |
| 61 | |
| 62 | publish-jsr: |
| 63 | needs: build-release |
| 64 | runs-on: ubuntu-latest |
| 65 | |
| 66 | permissions: |
| 67 | contents: read |
| 68 | id-token: write |
| 69 | |
| 70 | steps: |
| 71 | - name: Checkout |
| 72 | uses: actions/checkout@v4 |
| 73 | |
| 74 | - name: Setup Node.js |
| 75 | uses: actions/setup-node@v4 |
| 76 | with: |
| 77 | node-version: 20.x |
| 78 | |
| 79 | - name: Read package.json version |
| 80 | id: package-version |
| 81 | uses: jaywcjlove/github-action-package@main |
| 82 | |
| 83 | - name: Publish Release |
| 84 | if: ${{ contains(steps.package-version.outputs.version, '-') == false }} |
| 85 | run: npx jsr publish --allow-dirty |
| 86 | |
| 87 | publish-npm: |
| 88 | needs: build-release |
| 89 | runs-on: ubuntu-latest |
| 90 | |
| 91 | steps: |
| 92 | - name: Checkout |
| 93 | uses: actions/checkout@v4 |
| 94 | |
| 95 | - name: Setup pnpm |
| 96 | uses: pnpm/action-setup@v4 |
| 97 | |
| 98 | - name: Setup Node.js |
| 99 | uses: actions/setup-node@v4 |
| 100 | with: |
| 101 | node-version: 20.x |
| 102 | registry-url: https://registry.npmjs.org/ |
| 103 | cache: 'pnpm' |
| 104 | |
| 105 | - name: Install Dependencies |
| 106 | run: pnpm install --ignore-scripts --frozen-lockfile |
| 107 | |
| 108 | - name: Read package.json version |
| 109 | id: package-version |
| 110 | uses: jaywcjlove/github-action-package@main |
| 111 | |
| 112 | - name: Publish Release |
| 113 | if: ${{ contains(steps.package-version.outputs.version, '-') == false }} |
| 114 | run: pnpm publish --no-git-checks |
| 115 | env: |
| 116 | NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
| 117 | |
| 118 | - name: Publish Pre-Release |
| 119 | if: ${{ contains(steps.package-version.outputs.version, '-') == true && contains(steps.package-version.outputs.version, '-beta') == false }} |
| 120 | run: pnpm publish --no-git-checks --tag next |
| 121 | env: |
| 122 | NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
| 123 | |
| 124 | - name: Publish Beta Release |
| 125 | if: ${{ contains(steps.package-version.outputs.version, '-beta') == true }} |
| 126 | run: pnpm publish --no-git-checks --tag beta |
| 127 | env: |
| 128 | NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |