chore: release v3.1.3 and migrate to OIDC Trusted Publishing #11
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: | |
| - release | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| permissions: | |
| id-token: write # Required for Trusted publishing | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| release: | |
| name: Release | |
| runs-on: ubuntu-latest | |
| continue-on-error: false | |
| outputs: | |
| releaseReady: ${{ steps.releaseOutputs.outputs.releaseReady }} | |
| steps: | |
| - name: Cancel previous jobs | |
| uses: styfle/[email protected] | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| - name: Configure git user | |
| uses: ./.github/actions/github-config | |
| with: | |
| gpg-key-base64: ${{ secrets.CI_GITHUB_GPG_KEY_BASE64 }} | |
| gpg-key-signing: ${{ secrets.CI_GITHUB_GPG_KEY_SIGNING }} | |
| - name: Prepare node | |
| uses: ./.github/actions/prepare-node | |
| id: prepare-node | |
| with: | |
| node-version: 20 | |
| registry-url: "https://registry.npmjs.org/" | |
| package-manager: "pnpm" | |
| scope: "@macpaw" | |
| # Trusted publishing requires npm CLI version 11.5.1 or later. | |
| - name: Update npm | |
| run: npm install -g npm@latest | |
| - name: Create Release or publish to NPM Registry | |
| id: changesets | |
| uses: changesets/action@v1 | |
| with: | |
| publish: pnpm changes:release | |
| title: "ci(changesets): :package: version update for packages" | |
| commit: "chore(release): version update for packages" | |
| setupGitUser: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Generate outputs | |
| id: releaseOutputs | |
| if: steps.changesets.outputs.published == 'true' | |
| run: echo "releaseReady=true" >> $GITHUB_OUTPUT | |
| publish-github: | |
| name: Publish to Github Registry | |
| needs: release | |
| runs-on: ubuntu-latest | |
| continue-on-error: false | |
| if: needs.release.outputs.releaseReady == 'true' | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Cancel previous jobs | |
| uses: styfle/[email protected] | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| - name: Configure git user | |
| uses: ./.github/actions/github-config | |
| with: | |
| gpg-key-base64: ${{ secrets.CI_GITHUB_GPG_KEY_BASE64 }} | |
| gpg-key-signing: ${{ secrets.CI_GITHUB_GPG_KEY_SIGNING }} | |
| - name: Prepare node | |
| uses: ./.github/actions/prepare-node | |
| id: prepare-node | |
| with: | |
| node-version: 20 | |
| registry-url: "https://npm.pkg.github.com/" | |
| package-manager: "pnpm" | |
| scope: "@macpaw" | |
| - name: Authenticate with GitHub Packages | |
| run: | | |
| echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" > ~/.npmrc | |
| echo "@macpaw:registry=https://npm.pkg.github.com/" >> ~/.npmrc | |
| - name: Publish to Github Registry | |
| id: changesets | |
| uses: changesets/action@v1 | |
| with: | |
| publish: pnpm changes:release:gh | |
| setupGitUser: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |