Skip to content

Commit feaa863

Browse files
authored
ci: enhance CI configuration (#7146)
1 parent 5eb0d09 commit feaa863

16 files changed

Lines changed: 201 additions & 106 deletions
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929

3030
steps:
3131
- name: Checkout
32-
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
32+
uses: actions/checkout@v7
3333
with:
3434
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
3535
ref: ${{ github.event.pull_request.head.sha || github.sha }}
Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828

2929
steps:
3030
- name: Checkout
31-
uses: actions/checkout@v6
31+
uses: actions/checkout@v7
3232
with:
3333
persist-credentials: false
3434

@@ -48,15 +48,23 @@ jobs:
4848

4949
steps:
5050
- name: Checkout
51-
uses: actions/checkout@v6
51+
uses: actions/checkout@v7
5252
with:
5353
persist-credentials: false
5454

5555
- name: Setup Node.js
5656
uses: ./.github/actions/setup-node
5757

58+
- name: Restore ESLint cache
59+
uses: actions/cache@v6
60+
with:
61+
path: .eslintcache
62+
key: eslint-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml', 'package.json', 'eslint.config.ts') }}-${{ github.sha }}
63+
restore-keys: |
64+
eslint-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml', 'package.json', 'eslint.config.ts') }}-
65+
5866
- name: 🌡️ Run ESLint
59-
run: pnpm lint --quiet
67+
run: pnpm lint --quiet --cache --cache-location .eslintcache
6068

6169
typecheck:
6270
runs-on: ubuntu-latest
@@ -66,7 +74,7 @@ jobs:
6674

6775
steps:
6876
- name: Checkout
69-
uses: actions/checkout@v6
77+
uses: actions/checkout@v7
7078
with:
7179
persist-credentials: false
7280

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,25 +31,25 @@ jobs:
3131
printf '%s\n' "$PR_STATE" > ./pr-state.txt
3232
3333
- name: Upload PR number
34-
uses: actions/upload-artifact@v4
34+
uses: actions/upload-artifact@v7
3535
with:
3636
name: pr-id
3737
path: ./pr-id.txt
3838

3939
- name: Upload PR ref
40-
uses: actions/upload-artifact@v4
40+
uses: actions/upload-artifact@v7
4141
with:
4242
name: pr-ref
4343
path: ./pr-ref.txt
4444

4545
- name: Upload PR repo
46-
uses: actions/upload-artifact@v4
46+
uses: actions/upload-artifact@v7
4747
with:
4848
name: pr-repo
4949
path: ./pr-repo.txt
5050

5151
- name: Upload PR state
52-
uses: actions/upload-artifact@v4
52+
uses: actions/upload-artifact@v7
5353
with:
5454
name: pr-state
5555
path: ./pr-state.txt
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
name: 🌐 Deploy to GitHub Pages
2+
3+
on:
4+
push:
5+
branches: [dev]
6+
tags:
7+
- 'v*.*.*'
8+
- 'v*.*.*-alpha.*'
9+
- 'v*.*.*-beta.*'
10+
- 'v*.*.*-rc.*'
11+
12+
concurrency:
13+
group: github-pages
14+
cancel-in-progress: false
15+
16+
permissions:
17+
contents: write
18+
pull-requests: read
19+
20+
jobs:
21+
deploy:
22+
runs-on: ubuntu-latest
23+
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v7
27+
with:
28+
persist-credentials: false
29+
30+
- name: Setup Node.js
31+
uses: ./.github/actions/setup-node
32+
33+
# ================= Deploy Demo =================
34+
- name: 📦 Build demo
35+
run: pnpm build:demo
36+
37+
- name: Copy demo to workspace
38+
run: |
39+
mkdir -p dist
40+
cp -r ./examples/local/* dist
41+
42+
- name: 📦 Build react16 demo
43+
run: |
44+
pnpm use:react16
45+
pnpm build:demo
46+
47+
- name: Copy react16 demo
48+
run: |
49+
mkdir -p dist/react16
50+
cp -r ./examples/local/* dist/react16
51+
52+
# ================= Deploy Storybook =================
53+
- name: 📦 Build storybook
54+
run: pnpm storybook:build
55+
56+
- name: Copy storybook
57+
run: |
58+
mkdir -p dist/storybook
59+
cp -r ./common/storybook/storybook-static/* dist/storybook
60+
61+
- name: Checkout existing Pages branch
62+
uses: actions/checkout@v7
63+
continue-on-error: true
64+
with:
65+
ref: gh-pages
66+
path: gh-pages-current
67+
persist-credentials: false
68+
69+
- name: Preserve recent PR previews
70+
env:
71+
GH_TOKEN: ${{ github.token }}
72+
run: |
73+
if [ ! -d gh-pages-current/pr-preview ]; then
74+
exit 0
75+
fi
76+
77+
mkdir -p dist/pr-preview
78+
cutoff_epoch=$(date -u -d '30 days ago' +%s)
79+
shopt -s nullglob
80+
81+
for preview_dir in gh-pages-current/pr-preview/pr-*; do
82+
pr_number="${preview_dir##*/pr-}"
83+
if [[ ! "$pr_number" =~ ^[0-9]+$ ]]; then
84+
echo "Prune unexpected preview directory: ${preview_dir}"
85+
continue
86+
fi
87+
88+
if ! pr_info=$(gh api "repos/${GITHUB_REPOSITORY}/pulls/${pr_number}" --jq '[.state, (.closed_at // "")] | @tsv' 2>/dev/null); then
89+
echo "Prune preview for missing PR #${pr_number}"
90+
continue
91+
fi
92+
93+
IFS=$'\t' read -r state closed_at <<< "$pr_info"
94+
if [ "$state" = "open" ]; then
95+
echo "Keep preview for open PR #${pr_number}"
96+
cp -a "$preview_dir" "dist/pr-preview/"
97+
continue
98+
fi
99+
100+
if [ -n "$closed_at" ]; then
101+
closed_epoch=$(date -u -d "$closed_at" +%s)
102+
if [ "$closed_epoch" -ge "$cutoff_epoch" ]; then
103+
echo "Keep preview for recently closed PR #${pr_number}"
104+
cp -a "$preview_dir" "dist/pr-preview/"
105+
continue
106+
fi
107+
fi
108+
109+
echo "Prune preview for PR #${pr_number}"
110+
done
111+
112+
- name: Check Pages publish size
113+
run: |
114+
size_kb=$(du -sk dist | awk '{print $1}')
115+
max_kb=950000
116+
echo "Pages publish directory size: ${size_kb} KB"
117+
if [ "$size_kb" -gt "$max_kb" ]; then
118+
echo "Pages publish directory exceeds ${max_kb} KB. Largest entries:"
119+
du -h -d 2 dist | sort -hr | head -50
120+
exit 1
121+
fi
122+
123+
# ================= Deploy to GitHub Pages =================
124+
- name: 🚀 Deploy to GitHub Pages
125+
uses: peaceiris/actions-gh-pages@v4
126+
with:
127+
github_token: ${{ secrets.GITHUB_TOKEN }}
128+
publish_dir: ./dist
Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
steps:
3434
# Get PR id from artifact
3535
- name: download pr artifact
36-
uses: dawidd6/action-download-artifact@v9
36+
uses: dawidd6/action-download-artifact@v21
3737
with:
3838
workflow: ${{ github.event.workflow_run.workflow_id }}
3939
run_id: ${{ github.event.workflow_run.id }}
@@ -45,7 +45,7 @@ jobs:
4545

4646
# Get PR ref from artifact
4747
- name: download pr artifact
48-
uses: dawidd6/action-download-artifact@v9
48+
uses: dawidd6/action-download-artifact@v21
4949
with:
5050
workflow: ${{ github.event.workflow_run.workflow_id }}
5151
run_id: ${{ github.event.workflow_run.id }}
@@ -57,7 +57,7 @@ jobs:
5757

5858
# Get PR repo from artifact
5959
- name: download pr artifact
60-
uses: dawidd6/action-download-artifact@v9
60+
uses: dawidd6/action-download-artifact@v21
6161
with:
6262
workflow: ${{ github.event.workflow_run.workflow_id }}
6363
run_id: ${{ github.event.workflow_run.id }}
@@ -69,7 +69,7 @@ jobs:
6969

7070
# Get PR state from artifact
7171
- name: download pr state artifact
72-
uses: dawidd6/action-download-artifact@v9
72+
uses: dawidd6/action-download-artifact@v21
7373
with:
7474
workflow: ${{ github.event.workflow_run.workflow_id }}
7575
run_id: ${{ github.event.workflow_run.id }}
@@ -87,7 +87,7 @@ jobs:
8787
steps:
8888
# ================= Create Comment =================
8989
- name: 🧽 Find And Delete Comment
90-
uses: peter-evans/find-comment@v2
90+
uses: peter-evans/find-comment@v4
9191
if: ${{ needs.setup.outputs.id != '' }}
9292
id: fc
9393
with:
@@ -96,7 +96,7 @@ jobs:
9696
body-includes: View Deployment
9797

9898
- name: 📝 Create or update comment
99-
uses: peter-evans/create-or-update-comment@v3
99+
uses: peter-evans/create-or-update-comment@v5
100100
if: ${{ needs.setup.outputs.id != '' }}
101101
with:
102102
comment-id: ${{ steps.fc.outputs.comment-id }}
@@ -120,19 +120,19 @@ jobs:
120120

121121
steps:
122122
- name: Checkout
123-
uses: actions/checkout@v4
123+
uses: actions/checkout@v7
124124
with:
125125
repository: ${{ needs.setup.outputs.repo }}
126126
ref: ${{ needs.setup.outputs.ref }}
127127
persist-credentials: false
128128

129129
- name: Setup pnpm
130-
uses: pnpm/action-setup@v4
130+
uses: pnpm/action-setup@v6
131131
with:
132132
run_install: false
133133

134134
- name: Setup Node.js
135-
uses: actions/setup-node@v4
135+
uses: actions/setup-node@v6
136136
with:
137137
node-version: 24.3.0
138138
cache: pnpm
@@ -198,7 +198,7 @@ jobs:
198198
steps:
199199
# ================= Create Comment =================
200200
- name: 🧽 Find And Delete Comment
201-
uses: peter-evans/find-comment@v2
201+
uses: peter-evans/find-comment@v4
202202
if: ${{ needs.setup.outputs.id != '' }}
203203
id: fc
204204
with:
@@ -207,7 +207,7 @@ jobs:
207207
body-includes: View Deployment
208208

209209
- name: 📝 Create or update comment
210-
uses: peter-evans/create-or-update-comment@v3
210+
uses: peter-evans/create-or-update-comment@v5
211211
if: ${{ needs.setup.outputs.id != '' }}
212212
with:
213213
comment-id: ${{ steps.fc.outputs.comment-id }}

.github/workflows/dev-performance-log.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222

2323
steps:
2424
- name: Checkout
25-
uses: actions/checkout@v4
25+
uses: actions/checkout@v7
2626
with:
2727
persist-credentials: false
2828

@@ -38,7 +38,7 @@ jobs:
3838
uses: ./.github/actions/setup-node
3939

4040
- name: Cache Playwright browsers
41-
uses: actions/cache@v4
41+
uses: actions/cache@v6
4242
with:
4343
path: ~/.cache/ms-playwright
4444
key: ${{ runner.os }}-playwright-${{ hashFiles('pnpm-lock.yaml') }}
File renamed without changes.

0 commit comments

Comments
 (0)