Skip to content

Commit d1037f1

Browse files
authored
chore: ci (jdf2e#2687)
1 parent 6764b61 commit d1037f1

File tree

1 file changed

+65
-44
lines changed

1 file changed

+65
-44
lines changed

.github/workflows/ci.yml

Lines changed: 65 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -12,74 +12,95 @@ on:
1212
workflow_dispatch:
1313

1414
jobs:
15+
label:
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: Check out the repository
20+
uses: actions/checkout@v4
21+
22+
- name: Determine label
23+
id: determine_label
24+
run: |
25+
if [[ "${{ github.event.pull_request.base.ref }}" == "next" ]]; then
26+
echo "label=2.x" >> $GITHUB_ENV
27+
elif [[ "${{ github.event.pull_request.base.ref }}" == "V3.0" ]]; then
28+
echo "label=3.x" >> $GITHUB_ENV
29+
fi
30+
31+
- name: Add label to PR
32+
uses: actions-ecosystem/action-add-labels@v1
33+
with:
34+
github_token: ${{ secrets.GITHUB_TOKEN }}
35+
labels: ${{ env.label }}
1536
lint:
1637
runs-on: ubuntu-latest
1738
steps:
18-
- uses: actions/checkout@v4
39+
- uses: actions/checkout@v4
1940

20-
- name: Install pnpm
21-
run: corepack enable pnpm
41+
- name: Install pnpm
42+
run: corepack enable pnpm
2243

23-
- uses: actions/setup-node@v4
24-
with:
25-
node-version: '20'
26-
cache: 'pnpm'
44+
- uses: actions/setup-node@v4
45+
with:
46+
node-version: '20'
47+
cache: 'pnpm'
2748

28-
- name: Install dependencies
29-
run: pnpm install
49+
- name: Install dependencies
50+
run: pnpm install
3051

31-
- name: Run linter
32-
run: npm run lint
52+
- name: Run linter
53+
run: npm run lint
3354

3455
test:
3556
runs-on: ubuntu-latest
3657
steps:
37-
- uses: actions/checkout@v4
58+
- uses: actions/checkout@v4
3859

39-
- name: Install pnpm
40-
run: corepack enable pnpm
60+
- name: Install pnpm
61+
run: corepack enable pnpm
4162

42-
- uses: actions/setup-node@v4
43-
with:
44-
node-version: '20'
45-
cache: 'pnpm'
63+
- uses: actions/setup-node@v4
64+
with:
65+
node-version: '20'
66+
cache: 'pnpm'
4667

47-
- name: Install dependencies
48-
run: pnpm install
68+
- name: Install dependencies
69+
run: pnpm install
4970

50-
- name: Run test
51-
run: npm run test
71+
- name: Run test
72+
run: npm run test
5273

53-
- name: Upload coverage reports to Codecov
54-
if: ${{ always() }}
55-
uses: codecov/codecov-action@v4
56-
env:
57-
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
74+
- name: Upload coverage reports to Codecov
75+
if: ${{ always() }}
76+
uses: codecov/codecov-action@v4
77+
env:
78+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
5879

5980
build:
6081
runs-on: ubuntu-latest
6182
steps:
62-
- uses: actions/checkout@v4
83+
- uses: actions/checkout@v4
6384

64-
- name: Install pnpm
65-
run: corepack enable pnpm
85+
- name: Install pnpm
86+
run: corepack enable pnpm
6687

67-
- uses: actions/setup-node@v4
68-
with:
69-
node-version: '20'
70-
cache: 'pnpm'
88+
- uses: actions/setup-node@v4
89+
with:
90+
node-version: '20'
91+
cache: 'pnpm'
7192

72-
- name: Install dependencies
73-
run: pnpm install
93+
- name: Install dependencies
94+
run: pnpm install
7495

75-
- name: Build NutUI-React
76-
run: npm run build
96+
- name: Build NutUI-React
97+
run: npm run build
7798

78-
- name: Build NutUI-React-Taro
79-
run: npm run build:taro
99+
- name: Build NutUI-React-Taro
100+
run: npm run build:taro
80101

81-
- name: Build NutUI-React Demo
82-
run: npm run build:site
102+
- name: Build NutUI-React Demo
103+
run: npm run build:site
83104

84-
- name: Build NutUI-React Taro H5 Demo
85-
run: npm run build:taro:site
105+
- name: Build NutUI-React Taro H5 Demo
106+
run: npm run build:taro:site

0 commit comments

Comments
 (0)