[Changesets] Create versioned packages for publishing (#214) #182
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 packages | |
| on: | |
| push: | |
| branches: | |
| - main | |
| concurrency: ${{ github.workflow }}-${{ github.ref }} | |
| jobs: | |
| release: | |
| name: Release | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| # this is needed so that pushes to the version release branch will use the token we pass in below | |
| # otherwise the default token will be used, and we will not get an updated pkg.pr.new preview for that branch | |
| persist-credentials: false | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| run_install: false | |
| - name: Use Node.js 22.x | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: "22.x" | |
| cache: 'pnpm' | |
| - name: Install node deps | |
| run: pnpm i | |
| - name: Enable turborepo build cache | |
| uses: rharkor/[email protected] | |
| # ------------------------------------------------------------ | |
| - name: Create Release Pull Request or Publish to npm | |
| id: changesets | |
| uses: changesets/action@v1 | |
| with: | |
| title: "[Changesets] Versioned release" | |
| commit: "[Changesets] Create versioned packages for publishing" | |
| # This expects you to have a script called release which does a build for your packages and calls changeset publish | |
| publish: pnpm run changeset:publish | |
| version: pnpm run changeset:version | |
| env: | |
| # we use a personal token instead of the automatic repo one so that the binary release workflow will be triggered | |
| # (see https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/triggering-a-workflow#triggering-a-workflow-from-a-workflow) | |
| GITHUB_TOKEN: ${{ secrets.PUBLISHING_GITHUB_TOKEN }} | |
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| BUILD_TYPE: release | |
| # TODO: send notifications? |