allow writing to the git repo in release.yml (#1039) #708
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 | |
| concurrency: ${{ github.workflow }}-${{ github.ref }} | |
| permissions: | |
| id-token: write | |
| contents: write | |
| jobs: | |
| release: | |
| name: Release | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Repo | |
| # https://github.com/actions/checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: ./.github/actions/setup | |
| with: | |
| # Ensure npm 11.5.1 or later is installed | |
| # See https://docs.npmjs.com/trusted-publishers | |
| node-version: 24 | |
| - uses: ./.github/actions/lint | |
| - name: Create Release Pull Request or Publish to npm | |
| id: changesets | |
| # https://github.com/changesets/action | |
| uses: changesets/action@v1 | |
| with: | |
| createGithubReleases: false | |
| version: pnpm run version | |
| publish: pnpm run release | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: View outputs | |
| run: echo ${{join(steps.changesets.outputs.*, ' ')}} | |
| - name: Aggregate | |
| id: aggregate | |
| if: steps.changesets.outputs.published == 'true' | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| run: | | |
| node ./.changeset/aggregate.mjs | |
| - name: Create Release | |
| if: steps.changesets.outputs.published == 'true' | |
| uses: actions/create-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: ${{ steps.aggregate.outputs.version }} | |
| release_name: ${{ steps.aggregate.outputs.version }} | |
| body: ${{ steps.aggregate.outputs.notes }} | |
| draft: false | |
| prerelease: false |