-
-
Notifications
You must be signed in to change notification settings - Fork 175
87 lines (80 loc) · 3.23 KB
/
release.yml
File metadata and controls
87 lines (80 loc) · 3.23 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
79
80
81
82
83
84
85
86
87
name: Release
on:
push:
branches: [main, alpha, beta, rc, '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: read
jobs:
release:
name: Release
if: ${{ github.repository_owner == 'TanStack' }}
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
persist-credentials: true # changesets/action pushes version PR commits
- name: Setup Tools
uses: tanstack/config/.github/setup@e4b48f16568324f76f467aa4c2aac2f05db632c3 # main
- name: Build
run: pnpm build
- name: Test Unit
run: pnpm test:unit
- name: Install Playwright Chrome
run: pnpm --filter @tanstack/cli exec playwright install --with-deps chrome
- name: E2E Blocking
run: pnpm --filter @tanstack/cli test:e2e
- name: Enter Pre-Release Mode
if: "(contains(github.ref_name, '-pre') || github.ref_name == 'alpha' || github.ref_name == 'beta' || github.ref_name == 'rc') && !hashFiles('.changeset/pre.json')"
run: |
BRANCH="${GITHUB_REF_NAME}"
if [[ "$BRANCH" == "alpha" || "$BRANCH" == "beta" || "$BRANCH" == "rc" ]]; then
pnpm changeset pre enter "$BRANCH"
else
pnpm changeset pre enter pre
fi
- name: Determine dist-tag
id: dist-tag
run: |
BRANCH="${GITHUB_REF_NAME}"
if [[ "$BRANCH" == "alpha" || "$BRANCH" == "beta" || "$BRANCH" == "rc" ]]; then
echo "prerelease=true" >> "$GITHUB_OUTPUT"
echo "tag=$BRANCH" >> "$GITHUB_OUTPUT"
elif [[ "$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@63a615b9cd06ba9a3e6d13796c7fbcb080a60a0b # v1.8.0
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 ${PRERELEASE_FLAG} ${LATEST_FLAG}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PRERELEASE_FLAG: ${{ steps.dist-tag.outputs.prerelease == 'true' && '--prerelease' }}
LATEST_FLAG: ${{ steps.dist-tag.outputs.latest == 'true' && '--latest' }}