Skip to content

Commit a314f98

Browse files
authored
chore: standardize repository setup (#435)
* chore: standardize repository setup * ci: allow surge preview status updates * chore: address review feedback * chore: remove cloudflare preview and now-build * docs: standardize README release details * ci: make surge preview non-blocking * ci: keep surge preview as fallback * docs: refine README usage and ecosystem note * ci: isolate surge preview token * chore: address review comments * docs: add Chinese README * docs: add Ant Design logo to README * docs: refine bilingual README branding * chore: standardize rc tooling and docs * chore: address standardization review comments * chore: include father config in type checks * chore: ignore dumi build output * docs: add license file * ci: use actions checkout v7 * ci: update deploy action versions * chore: standardize package metadata * ci: standardize dependabot updates * chore: refine preview workflow ignores * ci: pin gh-pages deployment action * docs: document dumi dev server port * chore: standardize husky configuration * docs: align readme badge layout * chore: standardize package type entry * docs: normalize readme badges * ci: limit reusable workflow secrets * ci: restore reusable workflow compatibility * ci: narrow surge preview permissions * chore: limit reusable workflow secrets
1 parent 781afd9 commit a314f98

16 files changed

Lines changed: 451 additions & 313 deletions

.dumirc.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22
import { defineConfig } from 'dumi';
33
import path from 'path';
44

5-
const basePath = process.env.GITHUB_ACTIONS ? '/collapse/' : '/';
6-
const publicPath = process.env.GITHUB_ACTIONS ? '/collapse/' : '/';
5+
const basePath = process.env.GH_PAGES ? '/collapse/' : '/';
6+
const publicPath = basePath;
77

88
export default defineConfig({
9+
outputPath: 'docs-dist',
910
alias: {
1011
'rc-collapse$': path.resolve('src'),
1112
'rc-collapse/es': path.resolve('src'),

.github/FUNDING.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
github: ant-design
2+
open_collective: ant-design

.github/dependabot.yml

Lines changed: 17 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,19 @@
11
version: 2
22
updates:
3-
- package-ecosystem: npm
4-
directory: "/"
5-
schedule:
6-
interval: daily
7-
time: "21:00"
8-
open-pull-requests-limit: 10
9-
ignore:
10-
- dependency-name: "@types/react-dom"
11-
versions:
12-
- 17.0.0
13-
- 17.0.1
14-
- 17.0.2
15-
- dependency-name: "@types/react"
16-
versions:
17-
- 17.0.0
18-
- 17.0.1
19-
- 17.0.2
20-
- 17.0.3
21-
- dependency-name: np
22-
versions:
23-
- 7.2.0
24-
- 7.3.0
25-
- 7.4.0
26-
- dependency-name: less
27-
versions:
28-
- 4.1.0
3+
- package-ecosystem: npm
4+
directory: '/'
5+
schedule:
6+
interval: weekly
7+
day: monday
8+
time: '21:00'
9+
timezone: Asia/Shanghai
10+
open-pull-requests-limit: 10
11+
12+
- package-ecosystem: github-actions
13+
directory: '/'
14+
schedule:
15+
interval: weekly
16+
day: monday
17+
time: '21:00'
18+
timezone: Asia/Shanghai
19+
open-pull-requests-limit: 10
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
name: ✅ test
22
on: [push, pull_request]
3+
permissions:
4+
contents: read
35
jobs:
46
test:
5-
uses: react-component/rc-test/.github/workflows/test.yml@main
6-
secrets: inherit
7+
uses: react-component/rc-test/.github/workflows/test-utoo.yml@main
8+
secrets:
9+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/react-doctor.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: React Doctor
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened, ready_for_review]
6+
push:
7+
branches: [master]
8+
9+
permissions:
10+
contents: read
11+
pull-requests: write
12+
issues: write
13+
statuses: write
14+
15+
concurrency:
16+
group: react-doctor-${{ github.event.pull_request.number || github.ref }}
17+
cancel-in-progress: true
18+
19+
jobs:
20+
react-doctor:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: actions/checkout@v7
24+
with:
25+
fetch-depth: 0
26+
persist-credentials: false
27+
- uses: millionco/react-doctor@0b4f4f4bd248a154e64eb508a48347f71154b3f3

.github/workflows/site-deploy.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,14 @@ jobs:
1313
runs-on: ubuntu-latest
1414
steps:
1515
- name: checkout
16-
uses: actions/checkout@v3
16+
uses: actions/checkout@v7
17+
with:
18+
persist-credentials: false
1719

1820
- name: setup node
19-
uses: actions/setup-node@v1
21+
uses: actions/setup-node@v6
2022
with:
21-
node-version: 14
23+
node-version: 20
2224

2325
- name: create package-lock.json
2426
run: npm i --package-lock-only --ignore-scripts
@@ -30,10 +32,10 @@ jobs:
3032
run: npm run build
3133

3234
- name: Deploy to GitHub Pages
33-
uses: peaceiris/actions-gh-pages@v3
35+
uses: peaceiris/actions-gh-pages@329bcc8f12caed2cefe5a5b80781499a6f3b361b
3436
with:
3537
github_token: ${{ secrets.GITHUB_TOKEN }}
36-
publish_dir: ./dist
38+
publish_dir: ./docs-dist
3739
force_orphan: true
3840
user_name: 'github-actions[bot]'
3941
user_email: 'github-actions[bot]@users.noreply.github.com'
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Surge Preview
2+
3+
on:
4+
pull_request:
5+
6+
permissions:
7+
contents: read
8+
pull-requests: write
9+
checks: write
10+
11+
jobs:
12+
preview:
13+
runs-on: ubuntu-latest
14+
concurrency:
15+
group: surge-preview-${{ github.event.pull_request.number }}
16+
cancel-in-progress: true
17+
env:
18+
PREVIEW: true
19+
steps:
20+
- uses: actions/checkout@v7
21+
with:
22+
persist-credentials: false
23+
- name: Check Surge token
24+
id: surge-token
25+
env:
26+
SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }}
27+
run: |
28+
if [ -n "$SURGE_TOKEN" ]; then
29+
echo "enabled=true" >> "$GITHUB_OUTPUT"
30+
else
31+
echo "enabled=false" >> "$GITHUB_OUTPUT"
32+
fi
33+
- name: Build preview
34+
if: ${{ steps.surge-token.outputs.enabled == 'true' }}
35+
run: |
36+
npm install
37+
npm run build
38+
- uses: afc163/surge-preview@bf90a5a86111f6311ca42f0a5a0f80fb0fb03cec
39+
if: ${{ steps.surge-token.outputs.enabled == 'true' }}
40+
env:
41+
SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }}
42+
with:
43+
surge_token: ${{ env.SURGE_TOKEN }}
44+
github_token: ${{ secrets.GITHUB_TOKEN }}
45+
dist: docs-dist
46+
failOnError: false
47+
setCommitStatus: false
48+
- name: Skip Surge preview
49+
if: ${{ steps.surge-token.outputs.enabled != 'true' }}
50+
run: echo "SURGE_TOKEN is not configured; skip Surge preview."

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ pnpm-lock.yaml
3636
.dumi/tmp
3737
.dumi/tmp-production
3838
.dumi/tmp-test
39+
docs-dist
3940
.env.local
4041
src/.umi
4142

42-
bun.lockb
43+
bun.lockb

.husky/pre-commit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
lint-staged
1+
npx lint-staged

.prettierignore

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
node_modules
2+
coverage
3+
docs-dist
4+
dist
5+
es
6+
lib
7+
.dumi/tmp
8+
.dumi/tmp-production
9+
.vercel
10+
package-lock.json
11+
pnpm-lock.yaml
12+
yarn.lock
13+
bun.lockb
14+
*.log

0 commit comments

Comments
 (0)