ci: use separate changeset publishing pr (#10303) #1
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, 'v[0-9]', '*-pre', '*-maint'] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: false | |
| env: | |
| NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }} | |
| permissions: | |
| contents: write | |
| id-token: write | |
| pull-requests: write | |
| jobs: | |
| release: | |
| name: Release | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6.0.2 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Tools | |
| uses: TanStack/config/.github/setup@main | |
| - name: Determine dist-tag | |
| id: dist-tag | |
| run: | | |
| BRANCH="${GITHUB_REF_NAME}" | |
| if [[ "$BRANCH" == *-pre ]]; then | |
| echo "prerelease=true" >> "$GITHUB_OUTPUT" | |
| echo "tag=pre" >> "$GITHUB_OUTPUT" | |
| elif [[ "$BRANCH" == *-maint ]]; then | |
| echo "tag=maint" >> "$GITHUB_OUTPUT" | |
| elif [[ "$BRANCH" =~ ^v[0-9]+$ ]]; then | |
| echo "tag=$BRANCH" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "latest=true" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Create Release Pull Request or Publish | |
| id: changesets | |
| uses: changesets/action@v1 | |
| with: | |
| version: pnpm run changeset:version | |
| publish: pnpm run changeset:publish ${{ steps.dist-tag.outputs.tag && format('--tag {0}', steps.dist-tag.outputs.tag) }} | |
| title: 'ci: Version Packages' | |
| commit: 'ci: changeset release' | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Create GitHub Release | |
| if: steps.changesets.outputs.published == 'true' | |
| run: node scripts/create-github-release.mjs ${{ steps.dist-tag.outputs.prerelease == 'true' && '--prerelease' }} ${{ steps.dist-tag.outputs.latest == 'true' && '--latest' }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |