chore: add GitHub Actions workflow to release packages #1
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: | |
| branches: | |
| - main | |
| jobs: | |
| release-please: | |
| name: Run Release Please | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| outputs: | |
| releases_created: ${{ steps.release.outputs.releases_created }} | |
| paths_released: ${{ steps.release.outputs.paths_released }} | |
| steps: | |
| - name: Run release-please command | |
| id: release | |
| uses: googleapis/release-please-action@7987652d64b4581673a76e33ad5e98e3dd56832f | |
| build-and-publish: | |
| name: Build & Publish | |
| runs-on: ubuntu-latest | |
| needs: [release-please] | |
| if: needs.release-please.outputs.paths_released != '[]' | |
| strategy: | |
| matrix: | |
| path: ${{ fromJSON(needs.release-please.outputs.paths_released) }} | |
| permissions: | |
| contents: read | |
| id-token: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda | |
| - name: Setup NodeJS | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: latest | |
| cache: pnpm | |
| registry-url: "https://registry.npmjs.org" | |
| - name: Install dependencies | |
| run: pnpm i --frozen-lockfile | |
| - name: Build packages | |
| run: pnpm -r build | |
| - name: Publish package at ${{ matrix.path }} | |
| run: npm publish --provenance --access public | |
| working-directory: ${{ matrix.path }} | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |