Readability: sync/async cleanup, DRY, type safety, config fixes (#55) #235
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, '*-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 | |
| if: "github.repository_owner == 'TanStack' && !contains(github.event.head_commit.message, 'ci: changeset release')" | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6.0.1 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Tools | |
| uses: tanstack/config/.github/setup@main | |
| - name: Run Tests | |
| run: pnpm run test:ci --parallel=3 | |
| - name: Version Packages | |
| run: pnpm run changeset:version | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Commit Release | |
| id: commit | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git add . | |
| if git commit -m "ci: changeset release"; then | |
| git push | |
| echo "committed=true" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Set Dist Tag | |
| id: dist-tag | |
| if: steps.commit.outputs.committed == 'true' | |
| run: | | |
| branch="${GITHUB_REF_NAME}" | |
| if [[ "$branch" == *-pre ]]; then | |
| echo "tag=next" >> "$GITHUB_OUTPUT" | |
| elif [[ "$branch" == *-maint ]]; then | |
| echo "tag=maint" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Publish Packages | |
| if: steps.commit.outputs.committed == 'true' | |
| run: | | |
| if [[ -n "${{ steps.dist-tag.outputs.tag }}" ]]; then | |
| pnpm run changeset:publish --tag "${{ steps.dist-tag.outputs.tag }}" | |
| else | |
| pnpm run changeset:publish | |
| fi | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Create GitHub Release | |
| if: steps.commit.outputs.committed == 'true' | |
| run: | | |
| if [[ "${{ steps.dist-tag.outputs.tag }}" == 'next' ]]; then | |
| node scripts/create-github-release.mjs --prerelease | |
| else | |
| node scripts/create-github-release.mjs | |
| fi | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |