Open History to see the last commit
1name: Release
2
3on:
4 push:
5 branches: [main, alpha, beta]
6
7concurrency:
8 group: ${{ github.workflow }}-${{ github.event.number || github.ref }}
9 cancel-in-progress: true
10
11env:
12 NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
13
14permissions:
15 contents: write
16 id-token: write
17 pull-requests: write
18
19jobs:
20 release:
21 name: Release
22 if: github.repository_owner == 'TanStack'
23 runs-on: ubuntu-latest
24 steps:
25 - name: Checkout
26 uses: actions/checkout@v6.0.1
27 with:
28 fetch-depth: 0
29 - name: Setup Tools
30 uses: tanstack/config/.github/setup@main
31 - name: Run Tests
32 run: pnpm run lint && pnpm run build && pnpm run test
33 - name: Run Changesets (version or publish)
34 id: changesets
35 uses: changesets/action@v1.5.3
36 with:
37 version: pnpm run changeset:version
38 publish: pnpm run changeset:publish
39 commit: 'ci: Version Packages'
40 title: 'ci: Version Packages'
41 env:
42 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43 - name: Generate Docs
44 if: steps.changesets.outputs.published == 'true'
45 run: pnpm generate-docs
46 - name: Commit Generated Docs
47 if: steps.changesets.outputs.published == 'true'
48 run: |
49 if [ -n "$(git status --porcelain)" ]; then
50 git config user.name "github-actions[bot]"
51 git config user.email "github-actions[bot]@users.noreply.github.com"
52
53 BRANCH="docs/auto-update-$(date +%s)"
54 git checkout -b "$BRANCH"
55 git add docs/
56 git commit -m "docs: regenerate API documentation"
57 git push origin "$BRANCH"
58
59 gh pr create \
60 --title "docs: regenerate API documentation" \
61 --body "Automated documentation update from release" \
62 --base main \
63 --head "$BRANCH"
64 else
65 echo "No changes in generated docs"
66 fi
67 env:
68 GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
69 - name: Comment on PRs about release
70 if: steps.changesets.outputs.published == 'true'
71 uses: tanstack/config/.github/comment-on-release@main
72 with:
73 published-packages: ${{ steps.changesets.outputs.publishedPackages }}