Skip to content

Commit f23e952

Browse files
committed
ci: update npm install commands to clean dependencies first
This change modifies all workflow files to remove node_modules and package-lock.json before installing dependencies, ensuring clean installations and preventing potential caching issues in CI/CD pipelines. This addresses potential dependency conflicts and ensures consistent builds across different environments. ci: 更新 npm 安装命令以先清理依赖 此更改修改所有工作流程文件,在安装依赖项之前删除 node_modules 和 package-lock.json, 确保干净的安装并防止 CI/CD 管道中潜在的缓存问题。 这解决了潜在的依赖冲突并确保跨不同环境的一致构建。 Change-Id: Ie8bfd3f0b098399c64d6466bb1949e8a789f3168 Signed-off-by: OhYee <[email protected]>
1 parent cc7b349 commit f23e952

File tree

4 files changed

+32
-19
lines changed

4 files changed

+32
-19
lines changed

.github/workflows/ci.yml

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,11 @@ jobs:
2121
uses: actions/setup-node@v4
2222
with:
2323
node-version: ${{ matrix.node-version }}
24-
cache: 'npm'
2524

26-
- name: Install dependencies
27-
run: npm install
25+
- name: Clean and install dependencies
26+
run: |
27+
rm -rf node_modules package-lock.json
28+
npm install
2829
2930
- name: Type check
3031
run: npm run typecheck
@@ -49,10 +50,11 @@ jobs:
4950
uses: actions/setup-node@v4
5051
with:
5152
node-version: 18.x
52-
cache: 'npm'
5353

54-
- name: Install dependencies
55-
run: npm install
54+
- name: Clean and install dependencies
55+
run: |
56+
rm -rf node_modules package-lock.json
57+
npm install
5658
5759
- name: Run tests with coverage
5860
run: npm run test:coverage
@@ -79,11 +81,12 @@ jobs:
7981
uses: actions/setup-node@v4
8082
with:
8183
node-version: 18.x
82-
cache: 'npm'
8384
registry-url: 'https://registry.npmjs.org'
8485

85-
- name: Install dependencies
86-
run: npm install
86+
- name: Clean and install dependencies
87+
run: |
88+
rm -rf node_modules package-lock.json
89+
npm install
8790
8891
- name: Build
8992
run: npm run build

.github/workflows/publish.yml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,10 @@ jobs:
3636
node-version: '18'
3737
registry-url: 'https://registry.npmjs.org'
3838

39-
- name: Install dependencies
40-
run: npm install
39+
- name: Clean and install dependencies
40+
run: |
41+
rm -rf node_modules package-lock.json
42+
npm install
4143
4244
- name: Build
4345
id: build
@@ -64,8 +66,10 @@ jobs:
6466
registry-url: 'https://registry.npmjs.org'
6567
always-auth: true
6668

67-
- name: Install dependencies
68-
run: npm install
69+
- name: Clean and install dependencies
70+
run: |
71+
rm -rf node_modules package-lock.json
72+
npm install
6973
7074
- name: Build
7175
run: npm run build
@@ -96,8 +100,10 @@ jobs:
96100
registry-url: 'https://registry.npmjs.org'
97101
always-auth: true
98102

99-
- name: Install dependencies
100-
run: npm install
103+
- name: Clean and install dependencies
104+
run: |
105+
rm -rf node_modules package-lock.json
106+
npm install
101107
102108
- name: Build
103109
run: npm run build

.github/workflows/release-test.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,10 @@ jobs:
112112
TEST_PKG_NAME: ${{ steps.version.outputs.TEST_PKG_NAME }}
113113
VERSION: ${{ steps.version.outputs.VERSION }}
114114

115-
- name: Install dependencies
116-
run: npm install
115+
- name: Clean and install dependencies
116+
run: |
117+
rm -rf node_modules package-lock.json
118+
npm install
117119
118120
- name: Build
119121
run: npm run build

.github/workflows/release.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,10 @@ jobs:
5454
git push
5555
fi
5656
57-
- name: Install dependencies
58-
run: npm install
57+
- name: Clean and install dependencies
58+
run: |
59+
rm -rf node_modules package-lock.json
60+
npm install
5961
6062
- name: Build
6163
run: npm run build

0 commit comments

Comments
 (0)