-
-
Notifications
You must be signed in to change notification settings - Fork 5
78 lines (73 loc) · 2.39 KB
/
release.yml
File metadata and controls
78 lines (73 loc) · 2.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
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 }}