chore(ci): Use trusted publishing #34
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: Publish (npm) | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - ci | |
| env: | |
| CI: 1 | |
| jobs: | |
| publish-npm: | |
| name: Publish to npm | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup node | |
| uses: actions/setup-node@v2 | |
| with: | |
| node-version: 20 | |
| - run: | | |
| corepack enable | |
| pnpm i | |
| # Ensure npm 11.5.1 or later is installed (for trusted publishing) | |
| - name: Update npm | |
| run: npm install -g npm@latest | |
| - name: Create Release Pull Request or Publish to npm | |
| id: changesets | |
| uses: changesets/action@v1 | |
| with: | |
| publish: pnpm publish -r --access public | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.BOT_GH_TOKEN }} |