Migrate to trusted publishing #905
Workflow file for this run
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: Build and release | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - beta | |
| pull_request: | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| id-token: write | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Use Node.js ${{ steps.nvm.outputs.NODE_VERSION }} | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version-file: .nvmrc | |
| cache: "yarn" | |
| - name: Install dependencies | |
| run: yarn install --frozen-lockfile | |
| - name: Build | |
| run: yarn ci:build | |
| integration-tests: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Use Node.js ${{ steps.nvm.outputs.NODE_VERSION }} | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version-file: .nvmrc | |
| cache: "yarn" | |
| - name: Install dependencies | |
| run: yarn install --frozen-lockfile | |
| - name: Run integration tests | |
| run: yarn ci:integration | |
| release: | |
| runs-on: ubuntu-latest | |
| needs: [build, integration-tests] | |
| permissions: | |
| contents: write | |
| issues: write | |
| pull-requests: write | |
| if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/beta' | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Use Node.js ${{ steps.nvm.outputs.NODE_VERSION }} | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version-file: .nvmrc | |
| cache: "yarn" | |
| # See https://docs.npmjs.com/trusted-publishers | |
| # Find the latest version with `npm info npm@latest version` | |
| - name: Install suitable NPM version for trusted publishing | |
| run: npm install -g npm@11.12.0 | |
| - name: Install dependencies | |
| run: yarn install --frozen-lockfile | |
| - name: Build | |
| run: yarn build | |
| - name: Create Release Pull Request or Publish to npm | |
| id: changesets | |
| uses: changesets/action@v1 | |
| with: | |
| publish: yarn changeset publish | |
| title: "🦋 Release package updates" | |
| commit: "Bump package versions" | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |