@@ -2,13 +2,11 @@ name: Release
22
33on :
44 push :
5- branches : [main, alpha, beta, rc, v4]
6- repository_dispatch :
7- types : [release]
5+ branches : [main, 'v[0-9]', '*-pre', '*-maint']
86
97concurrency :
10- group : ${{ github.workflow }}-${{ github.event.number || github. ref }}
11- cancel-in-progress : true
8+ group : ${{ github.workflow }}-${{ github.ref }}
9+ cancel-in-progress : false
1210
1311env :
1412 NX_CLOUD_ACCESS_TOKEN : ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
@@ -21,54 +19,43 @@ permissions:
2119jobs :
2220 release :
2321 name : Release
24- if : github.repository_owner == 'TanStack'
2522 runs-on : ubuntu-latest
2623 steps :
2724 - name : Checkout
28- uses : actions/checkout@v6.0.1
25+ uses : actions/checkout@v6.0.2
2926 with :
3027 fetch-depth : 0
31- - name : Start Nx Agents
32- run : npx nx-cloud start-ci-run --distribute-on=".nx/workflows/dynamic-changesets.yaml"
3328 - name : Setup Tools
34- uses : tanstack /config/.github/setup@main
35- - name : Run Tests
36- run : pnpm run test:ci
37- - name : Stop Nx Agents
38- if : ${{ always() }}
39- run : npx nx-cloud stop-all-agents
40- # - name: Check for Changesets marked as major
41- # id: major
42- # run: |
43- # echo "found=false " >> $GITHUB_OUTPUT
44- # regex="(major)"
45- # shopt -s nullglob
46- # for file in .changeset/*.md; do
47- # if [[ $(cat $file) =~ $regex ]]; then
48- # echo "found=true" >> $GITHUB_OUTPUT
49- # fi
50- # done
51- - name : Run Changesets (version or publish)
29+ uses : TanStack /config/.github/setup@main
30+ - name : Run Build
31+ run : pnpm run build:all
32+ - name : Determine dist-tag
33+ id : dist-tag
34+ run : |
35+ BRANCH="${GITHUB_REF_NAME}"
36+ if [[ "$BRANCH" == *-pre ]]; then
37+ echo "prerelease=true" >> "$GITHUB_OUTPUT"
38+ echo "tag=pre " >> " $GITHUB_OUTPUT"
39+ elif [[ "$BRANCH" == *-maint ]]; then
40+ echo "tag=maint" >> "$GITHUB_OUTPUT"
41+ elif [[ "$BRANCH" =~ ^v[0-9]+$ ]]; then
42+ echo "tag=$BRANCH" >> "$GITHUB_OUTPUT"
43+ else
44+ echo "latest=true" >> "$GITHUB_OUTPUT"
45+ fi
46+ - name : Create Release Pull Request or Publish
5247 id : changesets
53- uses : changesets/action@v1.5.3
48+ uses : changesets/action@v1
5449 with :
5550 version : pnpm run changeset:version
56- publish : pnpm run changeset:publish
57- commit : ' ci: Version Packages'
51+ publish : pnpm run changeset:publish ${{ steps.dist-tag.outputs.tag && format('--tag {0}', steps.dist-tag.outputs.tag) }}
5852 title : ' ci: Version Packages'
53+ commit : ' ci: changeset release'
5954 env :
6055 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
61- # - name: Auto-merge Changesets PR
62- # if: steps.changesets.outputs.hasChangesets == 'true' && steps.major.outputs.found == 'false'
63- # run: |
64- # gh pr merge --squash "$PR_NUMBER"
65- # gh api --method POST /repos/$REPO/dispatches -f 'event_type=release'
66- # env:
67- # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
68- # REPO: ${{ github.repository }}
69- # PR_NUMBER: ${{ steps.changesets.outputs.pullRequestNumber }}
70- - name : Comment on PRs about release
56+ - name : Create GitHub Release
7157 if : steps.changesets.outputs.published == 'true'
72- uses : tanstack/config/.github/comment-on-release@main
73- with :
74- published-packages : ${{ steps.changesets.outputs.publishedPackages }}
58+ run : node scripts/create-github-release.mjs ${{ steps.dist-tag.outputs.prerelease == 'true' && '--prerelease' }} ${{ steps.dist-tag.outputs.latest == 'true' && '--latest' }}
59+ env :
60+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
61+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments