Skip to content

Commit bc5858f

Browse files
committed
Refactor GitHub Actions workflow to improve dependency installation process. Replace 'Clean install' step with 'Install dependencies' and implement conditional logic for using 'npm install' or 'npm ci' based on the presence of package-lock.json. This enhances compatibility and ensures a smoother CI pipeline.
1 parent e36854a commit bc5858f

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

.github/workflows/deployment.yml

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,14 @@ jobs:
2525
with:
2626
node-version: 18
2727
cache: 'npm'
28-
- name: Clean install
28+
- name: Install dependencies
2929
run: |
30-
rm -rf node_modules package-lock.json
3130
npm install -g [email protected]
32-
npm ci
31+
if [ ! -f "package-lock.json" ]; then
32+
npm install
33+
else
34+
npm ci
35+
fi
3336
- name: Generate AMF models
3437
run: npm run prepare
3538
- name: Install Playwright browsers
@@ -46,11 +49,14 @@ jobs:
4649
with:
4750
node-version: 18
4851
cache: 'npm'
49-
- name: Clean install
52+
- name: Install dependencies
5053
run: |
51-
rm -rf node_modules package-lock.json
5254
npm install -g [email protected]
53-
npm ci
55+
if (!(Test-Path "package-lock.json")) {
56+
npm install
57+
} else {
58+
npm ci
59+
}
5460
- name: Generate AMF models
5561
run: npm run prepare
5662
- name: Install Playwright browsers
@@ -76,7 +82,13 @@ jobs:
7682
registry-url: 'https://registry.npmjs.org'
7783
cache: 'npm'
7884
- name: Install dependencies
79-
run: npm ci
85+
run: |
86+
npm install -g [email protected]
87+
if [ ! -f "package-lock.json" ]; then
88+
npm install
89+
else
90+
npm ci
91+
fi
8092
- name: Read version from package.json
8193
uses: culshaw/read-package-node-version-actions@v1
8294
id: package-node-version

0 commit comments

Comments
 (0)