Skip to content

Commit a99c241

Browse files
committed
chore: standardize repository config
1 parent 8a718cb commit a99c241

11 files changed

Lines changed: 327 additions & 99 deletions

.dumirc.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,23 @@
22
import { defineConfig } from 'dumi';
33

44
const name = 'mentions';
5+
const isProdSite =
6+
process.env.GH_PAGES === '1' ||
7+
(process.env.GITHUB_ACTIONS === 'true' && process.env.PREVIEW !== 'true');
8+
9+
const basePath = isProdSite ? `/${name}/` : '/';
10+
const publicPath = isProdSite ? `/${name}/` : '/';
511

612
export default defineConfig({
713
favicons: ['https://avatars0.githubusercontent.com/u/9441414?s=200&v=4'],
814
themeConfig: {
915
name: '@rc-component/mentions',
1016
logo: 'https://avatars0.githubusercontent.com/u/9441414?s=200&v=4',
1117
},
12-
outputPath: '.doc',
18+
outputPath: 'docs-dist',
1319
exportStatic: {},
14-
base: `/${name}/`,
15-
publicPath: `/${name}/`,
20+
base: basePath,
21+
publicPath,
1622
styles: [
1723
`
1824
.markdown table {

.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
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Cloudflare Pages Preview
2+
3+
on:
4+
pull_request:
5+
6+
concurrency:
7+
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
8+
cancel-in-progress: true
9+
10+
permissions:
11+
contents: read
12+
deployments: write
13+
14+
jobs:
15+
preview:
16+
runs-on: ubuntu-latest
17+
env:
18+
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
19+
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
20+
CLOUDFLARE_PAGES_PROJECT: ${{ vars.CLOUDFLARE_PAGES_PROJECT }}
21+
PREVIEW: true
22+
steps:
23+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0
24+
with:
25+
persist-credentials: false
26+
- name: Skip Cloudflare Pages preview
27+
if: ${{ env.CLOUDFLARE_API_TOKEN == '' || env.CLOUDFLARE_ACCOUNT_ID == '' || env.CLOUDFLARE_PAGES_PROJECT == '' }}
28+
run: echo "Cloudflare Pages preview is not configured; skip deployment."
29+
- name: Install dependencies
30+
if: ${{ env.CLOUDFLARE_API_TOKEN != '' && env.CLOUDFLARE_ACCOUNT_ID != '' && env.CLOUDFLARE_PAGES_PROJECT != '' }}
31+
run: npm install
32+
- name: Build site
33+
if: ${{ env.CLOUDFLARE_API_TOKEN != '' && env.CLOUDFLARE_ACCOUNT_ID != '' && env.CLOUDFLARE_PAGES_PROJECT != '' }}
34+
run: npm run build
35+
- name: Deploy preview
36+
if: ${{ env.CLOUDFLARE_API_TOKEN != '' && env.CLOUDFLARE_ACCOUNT_ID != '' && env.CLOUDFLARE_PAGES_PROJECT != '' }}
37+
uses: cloudflare/wrangler-action@ebbaa1584979971c8614a24965b4405ff95890e0
38+
with:
39+
apiToken: ${{ env.CLOUDFLARE_API_TOKEN }}
40+
accountId: ${{ env.CLOUDFLARE_ACCOUNT_ID }}
41+
command: pages deploy docs-dist --project-name=${{ env.CLOUDFLARE_PAGES_PROJECT }} --branch=${{ github.head_ref }}
42+
gitHubToken: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/codeql.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: 'CodeQL'
2+
3+
on:
4+
push:
5+
branches: ['master']
6+
pull_request:
7+
branches: ['master']
8+
schedule:
9+
- cron: '31 2 * * 4'
10+
11+
jobs:
12+
analyze:
13+
name: Analyze
14+
runs-on: ubuntu-latest
15+
permissions:
16+
actions: read
17+
contents: read
18+
security-events: write
19+
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
language: [javascript]
24+
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0
28+
with:
29+
persist-credentials: false
30+
31+
- name: Initialize CodeQL
32+
uses: github/codeql-action/init@8aad20d150bbac5944a9f9d289da16a4b0d87c1e
33+
with:
34+
languages: ${{ matrix.language }}
35+
queries: +security-and-quality
36+
37+
- name: Autobuild
38+
uses: github/codeql-action/autobuild@8aad20d150bbac5944a9f9d289da16a4b0d87c1e
39+
40+
- name: Perform CodeQL Analysis
41+
uses: github/codeql-action/analyze@8aad20d150bbac5944a9f9d289da16a4b0d87c1e
42+
with:
43+
category: '/language:${{ matrix.language }}'

.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@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0
24+
with:
25+
fetch-depth: 0
26+
persist-credentials: false
27+
- uses: millionco/react-doctor@0b4f4f4bd248a154e64eb508a48347f71154b3f3
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Surge Preview
2+
3+
on:
4+
pull_request:
5+
6+
concurrency:
7+
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
8+
cancel-in-progress: true
9+
10+
permissions:
11+
contents: read
12+
pull-requests: write
13+
checks: write
14+
statuses: write
15+
16+
jobs:
17+
preview:
18+
runs-on: ubuntu-latest
19+
env:
20+
SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }}
21+
PREVIEW: true
22+
steps:
23+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0
24+
with:
25+
persist-credentials: false
26+
- uses: afc163/surge-preview@bf90a5a86111f6311ca42f0a5a0f80fb0fb03cec
27+
if: ${{ env.SURGE_TOKEN != '' }}
28+
with:
29+
surge_token: ${{ env.SURGE_TOKEN }}
30+
github_token: ${{ secrets.GITHUB_TOKEN }}
31+
dist: docs-dist
32+
failOnError: true
33+
setCommitStatus: true
34+
build: |
35+
npm install
36+
npm run build
37+
- name: Skip Surge preview
38+
if: ${{ env.SURGE_TOKEN == '' }}
39+
run: echo "SURGE_TOKEN is not configured; skip Surge preview."

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,13 @@ tslint.json
3838
tsconfig.test.json
3939
.prettierignore
4040
.doc/
41+
docs-dist/
4142

4243
# dumi
4344
.dumi/tmp
4445
.dumi/tmp-test
4546
.dumi/tmp-production
4647

47-
bun.lockb
48+
bun.lockb
49+
.vercel
50+
.vercel

0 commit comments

Comments
 (0)