Skip to content

Commit 4bd4f74

Browse files
authored
ci: update action (vbenjs#4046)
* ci: update action
1 parent 84c8fb0 commit 4bd4f74

File tree

14 files changed

+99
-104
lines changed

14 files changed

+99
-104
lines changed

.github/actions/setup-node/action.yml

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: "Setup Node"
2+
3+
description: "Setup node and pnpm"
4+
5+
runs:
6+
using: "composite"
7+
steps:
8+
- name: Install pnpm
9+
uses: pnpm/action-setup@v4
10+
11+
- name: Install Node.js
12+
uses: actions/setup-node@v4
13+
with:
14+
node-version-file: .node-version
15+
cache: "pnpm"
16+
17+
- name: Get pnpm store directory
18+
shell: bash
19+
run: |
20+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
21+
22+
- uses: actions/cache@v4
23+
name: Setup pnpm cache
24+
if: ${{ github.ref_name == 'main' }}
25+
with:
26+
path: ${{ env.STORE_PATH }}
27+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
28+
restore-keys: |
29+
${{ runner.os }}-pnpm-store-
30+
31+
- uses: actions/cache/restore@v4
32+
if: ${{ github.ref_name != 'main' }}
33+
with:
34+
path: ${{ env.STORE_PATH }}
35+
key: |
36+
${{ runner.os }}-pnpm-store-
37+
38+
- name: Install dependencies
39+
shell: bash
40+
run: pnpm install --frozen-lockfile

.github/workflows/build.yml

+10-15
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,17 @@ concurrency:
1313
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
1414
cancel-in-progress: true
1515

16+
permissions:
17+
contents: read
18+
pull-requests: write
19+
1620
jobs:
1721
post-update:
1822
# if: ${{ github.actor == 'dependabot[bot]' }}
1923
runs-on: ubuntu-latest
20-
strategy:
21-
matrix:
22-
node-version: [20]
24+
env:
25+
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
26+
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
2327
steps:
2428
- name: Checkout code
2529
uses: actions/checkout@v4
@@ -28,21 +32,12 @@ jobs:
2832

2933
- name: Checkout out pull request
3034
env:
31-
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
35+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3236
run: |
3337
gh pr checkout ${{ github.event.pull_request.number }}
3438
35-
- name: Install pnpm
36-
uses: pnpm/action-setup@v4
37-
38-
- name: Use Node.js ${{ matrix.node-version }}
39-
uses: actions/setup-node@v4
40-
with:
41-
node-version: ${{ matrix.node-version }}
42-
cache: "pnpm"
43-
44-
- name: Install dependencies
45-
run: pnpm install --frozen-lockfile
39+
- name: Setup Node
40+
uses: ./.github/actions/setup-node
4641

4742
- name: Build
4843
run: |

.github/workflows/changeset-version.yml

+3-16
Original file line numberDiff line numberDiff line change
@@ -23,27 +23,14 @@ jobs:
2323
timeout-minutes: 15
2424
runs-on: ubuntu-latest
2525

26-
strategy:
27-
matrix:
28-
node-version: [20]
29-
3026
steps:
3127
- name: Checkout code
3228
uses: actions/checkout@v4
3329
with:
3430
fetch-depth: 0
3531

36-
- name: Install pnpm
37-
uses: pnpm/action-setup@v4
38-
39-
- name: Use Node.js ${{ matrix.node-version }}
40-
uses: actions/setup-node@v4
41-
with:
42-
node-version: ${{ matrix.node-version }}
43-
cache: "pnpm"
44-
45-
- name: Install dependencies
46-
run: pnpm install --frozen-lockfile
32+
- name: Setup Node
33+
uses: ./.github/actions/setup-node
4734

4835
- name: Create Release Pull Request
4936
uses: changesets/action@v1
@@ -52,4 +39,4 @@ jobs:
5239
commit: "chore: bump versions"
5340
title: "chore: bump versions"
5441
env:
55-
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
42+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/ci.yml

+6-46
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ jobs:
2121
runs-on: ${{ matrix.os }}
2222
strategy:
2323
matrix:
24-
node-version: [20]
2524
os:
2625
- ubuntu-latest
2726
- macos-latest
@@ -38,27 +37,8 @@ jobs:
3837
with:
3938
run_install: false
4039

41-
- name: Use Node.js ${{ matrix.node-version }}
42-
uses: actions/setup-node@v4
43-
with:
44-
node-version: ${{ matrix.node-version }}
45-
cache: "pnpm"
46-
47-
- name: Find pnpm store path
48-
shell: bash
49-
run: |
50-
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
51-
52-
- name: Setup pnpm cache
53-
uses: actions/cache@v4
54-
with:
55-
path: ${{ env.STORE_PATH }}
56-
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
57-
restore-keys: |
58-
${{ runner.os }}-pnpm-store-
59-
60-
- name: Install dependencies
61-
run: pnpm install --frozen-lockfile
40+
- name: Setup Node
41+
uses: ./.github/actions/setup-node
6242

6343
# - name: Check Git version
6444
# run: git --version
@@ -80,7 +60,6 @@ jobs:
8060
runs-on: ${{ matrix.os }}
8161
strategy:
8262
matrix:
83-
node-version: [20]
8463
os:
8564
- ubuntu-latest
8665
- macos-latest
@@ -92,17 +71,8 @@ jobs:
9271
with:
9372
fetch-depth: 0
9473

95-
- name: Install pnpm
96-
uses: pnpm/action-setup@v4
97-
98-
- name: Use Node.js ${{ matrix.node-version }}
99-
uses: actions/setup-node@v4
100-
with:
101-
node-version: ${{ matrix.node-version }}
102-
cache: "pnpm"
103-
104-
- name: Install dependencies
105-
run: pnpm install --frozen-lockfile
74+
- name: Setup Node
75+
uses: ./.github/actions/setup-node
10676

10777
- name: Lint
10878
run: pnpm run lint
@@ -113,7 +83,6 @@ jobs:
11383
timeout-minutes: 20
11484
strategy:
11585
matrix:
116-
node-version: [20]
11786
os:
11887
- ubuntu-latest
11988
- macos-latest
@@ -124,17 +93,8 @@ jobs:
12493
with:
12594
fetch-depth: 0
12695

127-
- name: Install pnpm
128-
uses: pnpm/action-setup@v4
129-
130-
- name: Use Node.js ${{ matrix.node-version }}
131-
uses: actions/setup-node@v4
132-
with:
133-
node-version: ${{ matrix.node-version }}
134-
cache: "pnpm"
135-
136-
- name: Install dependencies
137-
run: pnpm install --frozen-lockfile
96+
- name: Setup Node
97+
uses: ./.github/actions/setup-node
13898

13999
- name: Typecheck
140100
run: pnpm check:type

.github/workflows/deploy.yml

+2-15
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@ jobs:
1010
name: Deploy Push Ftp
1111
if: github.actor != 'dependabot[bot]' && !contains(github.event.head_commit.message, '[skip ci]')
1212
runs-on: ubuntu-latest
13-
strategy:
14-
matrix:
15-
node-version: [20]
16-
1713
steps:
1814
- name: Checkout code
1915
uses: actions/checkout@v4
@@ -33,17 +29,8 @@ jobs:
3329
sed -i "s#VITE_PWA\s*=.*#VITE_PWA = true#g" ./apps/web-naive/.env.production
3430
cat ./apps/web-naive/.env.production
3531
36-
- name: Install pnpm
37-
uses: pnpm/action-setup@v4
38-
39-
- name: Use Node.js ${{ matrix.node-version }}
40-
uses: actions/setup-node@v4
41-
with:
42-
node-version: ${{ matrix.node-version }}
43-
cache: "pnpm"
44-
45-
- name: Install dependencies
46-
run: pnpm install --frozen-lockfile
32+
- name: Setup Node
33+
uses: ./.github/actions/setup-node
4734

4835
- name: Build
4936
run: pnpm run build

.github/workflows/draft.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ jobs:
1414
steps:
1515
- uses: release-drafter/release-drafter@v6
1616
env:
17-
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
17+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/issue-close-require.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ on:
66
schedule:
77
- cron: "0 0 * * *"
88

9+
permissions:
10+
pull-requests: write
11+
contents: write
12+
913
jobs:
1014
close-issues:
1115
runs-on: ubuntu-latest
@@ -16,6 +20,6 @@ jobs:
1620
uses: actions-cool/issues-helper@v3
1721
with:
1822
actions: "close-issues" # 执行动作:关闭 Issues
19-
token: ${{ secrets.ACCESS_TOKEN }} # GitHub Token,用于认证
23+
token: ${{ secrets.GITHUB_TOKEN }} # GitHub Token,用于认证
2024
labels: "need reproduction" # 目标标签
2125
inactive-day: 3 # 未活动天数阈值

.github/workflows/issue-labeled.yml

+8-3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ on:
66
# pull_request:
77
# types: [labeled]
88

9+
permissions:
10+
issues: write
11+
pull-requests: write
12+
contents: write
13+
914
jobs:
1015
reply-labeled:
1116
runs-on: ubuntu-latest
@@ -15,7 +20,7 @@ jobs:
1520
uses: actions-cool/issues-helper@v3
1621
with:
1722
actions: "remove-labels"
18-
token: ${{ secrets.ACCESS_TOKEN }}
23+
token: ${{ secrets.GITHUB_TOKEN }}
1924
issue-number: ${{ github.event.issue.number }}
2025
labels: "enhancement: pending triage"
2126

@@ -24,7 +29,7 @@ jobs:
2429
uses: actions-cool/issues-helper@v3
2530
with:
2631
actions: "remove-labels"
27-
token: ${{ secrets.ACCESS_TOKEN }}
32+
token: ${{ secrets.GITHUB_TOKEN }}
2833
issue-number: ${{ github.event.issue.number }}
2934
labels: "bug: pending triage"
3035

@@ -33,7 +38,7 @@ jobs:
3338
uses: actions-cool/issues-helper@v3
3439
with:
3540
actions: "create-comment, remove-labels"
36-
token: ${{ secrets.ACCESS_TOKEN }}
41+
token: ${{ secrets.GITHUB_TOKEN }}
3742
issue-number: ${{ github.event.issue.number }}
3843
body: |
3944
Hello @${{ github.event.issue.user.login }}. Please provide the complete reproduction steps and code. Issues labeled by `needs reproduction` will be closed if no activities in 3 days.

.github/workflows/lock.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
steps:
1616
- uses: dessant/lock-threads@v5
1717
with:
18-
github-token: ${{ secrets.ACCESS_TOKEN }}
18+
github-token: ${{ secrets.GITHUB_TOKEN }}
1919
issue-inactive-days: "30"
2020
issue-lock-reason: ""
2121
pr-inactive-days: "30"

.github/workflows/release-tag.yml

+6-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ on:
88
env:
99
HUSKY: "0"
1010

11+
permissions:
12+
pull-requests: write
13+
contents: write
14+
1115
jobs:
1216
build:
1317
name: Create Release
@@ -58,7 +62,7 @@ jobs:
5862
version: ${{ steps.version.outputs.version }}
5963
publish: true
6064
env:
61-
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
65+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6266

6367
# - name: force update major tag
6468
# run: |
@@ -69,7 +73,7 @@ jobs:
6973
# id: release_tag
7074
# uses: ncipollo/release-action@v1
7175
# with:
72-
# token: ${{ secrets.ACCESS_TOKEN }}
76+
# token: ${{ secrets.GITHUB_TOKEN }}
7377
# generateReleaseNotes: "true"
7478
# body: |
7579
# > Please refer to [CHANGELOG.md](https://github.com/vbenjs/vue-vben-admin/blob/main/CHANGELOG.md) for details.

.github/workflows/semantic-pull-request.yml

+15-1
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,19 @@ jobs:
2222
didn't match the configured pattern. Please ensure that the subject
2323
doesn't start with an uppercase character.
2424
requireScope: false
25+
types: |
26+
fix
27+
feat
28+
docs
29+
style
30+
refactor
31+
perf
32+
test
33+
build
34+
ci
35+
chore
36+
revert
37+
types
38+
release
2539
env:
26-
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
40+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/stale.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
steps:
1111
- uses: actions/stale@v9
1212
with:
13-
repo-token: ${{ secrets.ACCESS_TOKEN }}
13+
repo-token: ${{ secrets.GITHUB_TOKEN }}
1414
stale-issue-message: "This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days"
1515
stale-pr-message: "This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days"
1616
exempt-issue-labels: "bug,enhancement"

.node-version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20
1+
20.14.0

internal/lint-configs/commitlint-config/index.mjs

-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,6 @@ const userConfig = {
145145
'revert',
146146
'types',
147147
'release',
148-
'improvement',
149148
],
150149
],
151150
},

0 commit comments

Comments
 (0)