|
| 1 | +name: Release and Publish |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main] |
| 6 | + |
| 7 | +concurrency: |
| 8 | + group: release-${{ github.ref }} |
| 9 | + cancel-in-progress: false |
| 10 | + |
| 11 | +permissions: {} |
| 12 | + |
| 13 | +jobs: |
| 14 | + release: |
| 15 | + name: Create Release |
| 16 | + runs-on: ubuntu-latest |
| 17 | + outputs: |
| 18 | + paths_released: ${{ steps.create-release.outputs.paths_released }} |
| 19 | + releases_created: ${{ steps.create-release.outputs.releases_created }} |
| 20 | + steps: |
| 21 | + - name: Harden Runner |
| 22 | + uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 |
| 23 | + with: |
| 24 | + egress-policy: audit |
| 25 | + |
| 26 | + - name: Checkout |
| 27 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 28 | + |
| 29 | + - name: Create release with release-please |
| 30 | + uses: googleapis/release-please-action@a02a34c4d625f9be7cb89156071d8567266a2445 # v4.2.0 |
| 31 | + id: create-release |
| 32 | + with: |
| 33 | + token: ${{ secrets.RELEASE_PLEASE_TOKEN }} |
| 34 | + release-type: node |
| 35 | + |
| 36 | + publish: |
| 37 | + name: Publish Packages |
| 38 | + if: needs.release.outputs.releases_created == 'true' |
| 39 | + runs-on: ubuntu-latest |
| 40 | + needs: release |
| 41 | + permissions: |
| 42 | + contents: read |
| 43 | + id-token: write # For provenance |
| 44 | + strategy: |
| 45 | + fail-fast: false |
| 46 | + matrix: |
| 47 | + path: ${{ fromJson(needs.release.outputs.paths_released) }} |
| 48 | + steps: |
| 49 | + - name: Harden Runner |
| 50 | + uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 |
| 51 | + with: |
| 52 | + egress-policy: audit |
| 53 | + |
| 54 | + - name: Checkout |
| 55 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 56 | + |
| 57 | + - name: Setup pnpm |
| 58 | + uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0 |
| 59 | + |
| 60 | + - name: Setup Node.js |
| 61 | + uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 |
| 62 | + with: |
| 63 | + node-version-file: '.nvmrc' |
| 64 | + registry-url: 'https://registry.npmjs.org' |
| 65 | + cache: 'pnpm' |
| 66 | + |
| 67 | + - name: Publish package with provenance |
| 68 | + working-directory: ${{ matrix.path }} |
| 69 | + env: |
| 70 | + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
| 71 | + NPM_CONFIG_PROVENANCE: true |
| 72 | + run: pnpm publish --access=public --provenance |
0 commit comments