-
Notifications
You must be signed in to change notification settings - Fork 5
169 lines (138 loc) · 4.97 KB
/
Copy pathrelease.yaml
File metadata and controls
169 lines (138 loc) · 4.97 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
name: CI / Release
on:
workflow_dispatch:
push:
paths-ignore:
- .github/**
- '!.github/workflows/release.yaml'
- '**/*.md'
branches:
- '([0-9])?(.{+([0-9]),x}).x'
- main
- next
- next-major
- alpha
- beta
- 'feat/*'
- 'fix/*'
permissions:
contents: read
concurrency:
group: ci-release-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
NODE_VERSION: 24
jobs:
release:
name: CI / Release
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: write
issues: write
pull-requests: write
id-token: write
steps:
- name: Harden runner
uses: step-security/harden-runner@a90bcbc6539c36a85cdfeb73f7e2f433735f215b # v2.15.0
with:
egress-policy: audit
- name: Git checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
- name: Setup PNPM
uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
with:
registry-url: https://registry.npmjs.org
node-version: ${{ env.NODE_VERSION }}
cache: pnpm
- name: Install packages
run: pnpm install --frozen-lockfile
- name: Verify installed prod dependency attestations
run: node --run audit
- name: Setup Turbo cache
uses: dtinth/setup-github-actions-caching-for-turbo@cc723b4600e40a6b8815b65701d8614b91e2669e # v1.3.0
- name: Clean build outputs
run: node --run clean
- name: Build packages
run: node --run build
- name: Cache ESLint results
uses: actions/cache@v4
with:
path: .eslintcache
key:
eslint-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml',
'eslint.config.js') }}
- name: Lint JS and TS
run: node --run lint:es
- name: Lint CSS
run: node --run lint:style
- name: Check formatting
run: node --run format
- name: Tests - units
run: node --run test:unit
- name: Tests - types
run: node --run test:types
- name: Cache Playwright browsers
uses: actions/cache@v4
with:
path: ~/.cache/ms-playwright
key: playwright-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }}
- name: Install Playwright browsers
run: pnpm exec playwright install --with-deps chromium
- name: Tests - E2E
run: node --run test:e2e
- name: Git user configuration
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/next'
run: |
git config --global user.name "${{ github.actor }}"
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
- name: Publish [main]
if: github.ref == 'refs/heads/main'
id: graduateRelease
continue-on-error: true
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_CONFIG_PROVENANCE: 'true'
run: |
pnpm exec lerna publish --message 'chore: publish [main] release [skip ci]' --create-release=github --conventional-graduate --force-git-tag --yes
- name: Publish [main] fallback
if:
${{ always() && github.ref == 'refs/heads/main' &&
steps.graduateRelease.outcome == 'failure' }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_CONFIG_PROVENANCE: 'true'
run: |
echo "Graduate publish failed - attempting recovery"
git stash || true
echo "==> from-package: recovering partial publish"
FROM_PKG_OUT=$(pnpm exec lerna publish from-package --yes 2>&1)
FROM_PKG_EXIT=$?
echo "$FROM_PKG_OUT"
echo "==> non-graduate: publishing new or changed packages"
OUTPUT=$(pnpm exec lerna publish --message 'chore: publish [main] release [skip ci]' --create-release=github --yes 2>&1) || true
echo "$OUTPUT"
if [ "$FROM_PKG_EXIT" -ne 0 ] && echo "$OUTPUT" | grep -q 'No changed packages to publish'; then
echo "::error::Neither from-package nor conventional fallback published anything"
exit 1
fi
- name: Publish [next]
if: github.ref == 'refs/heads/next'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_CONFIG_PROVENANCE: 'true'
run: |
pnpm exec lerna publish --message 'chore: publish [next] pre-release' --conventional-prerelease --pre-dist-tag=next --preid=next --yes
- name: Merge back main into next
if: github.ref == 'refs/heads/main'
continue-on-error: true
env:
GH_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
run: |
git checkout next
git merge main --no-ff -m 'chore: auto-merge main into next [skip ci]'
git push