Skip to content

Commit b9a4658

Browse files
authored
refactor: cicd install process (#1446)
* refactor: cicd install process * fix: enabled bahmutov/npm-install as default
1 parent 6b38441 commit b9a4658

File tree

3 files changed

+16
-29
lines changed

3 files changed

+16
-29
lines changed

.github/actions/npm-cache/action.yml

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,38 +10,36 @@ inputs:
1010
description: "Path for package-lock.json"
1111
required: false
1212
default: "**/package-lock.json"
13-
outputs:
14-
cache-hit:
15-
description: "A boolean value to indicate an exact match was found for the primary key"
16-
value: ${{ steps.set-cache.outputs.cache-hit }}
13+
nodeVersion:
14+
description: "Node version"
15+
required: false
16+
default: "18"
1717
runs:
1818
using: "composite"
1919
steps:
20-
- name: Setup node equally to our local development version
20+
- name: 🆙 Setup node
2121
# pick the Node version to use and install it
2222
# https://github.com/actions/setup-node
2323
uses: actions/setup-node@v3
2424
with:
25-
node-version: 18
25+
node-version: ${{ inputs.nodeVersion }}
2626

2727
- name: Display node and npm version
2828
shell: bash
2929
run: |
3030
node --version
3131
npm --version
3232
33-
- name: Init Cache
33+
- name: 🆒 Init Cache
3434
uses: actions/cache@v3
35-
id: "npm-cache"
35+
id: "cache"
3636
with:
3737
path: ${{ inputs.nodeModulesPath }}
38-
key: ${{ runner.os }}-node-${{ hashFiles(inputs.packageLockPath) }}
38+
key: ${{ runner.os }}-node-${{ inputs.nodeVersion }}-${{ hashFiles(inputs.packageLockPath) }}
3939
restore-keys: |
40-
${{ runner.os }}-node-
40+
${{ runner.os }}-node-${{ inputs.nodeVersion }}
4141
42-
- name: 🥊 Set cache-hit
43-
id: "set-cache"
44-
run: echo "cache-hit=$CACHE_HIT" >> $GITHUB_OUTPUT
42+
- name: ⏬ NPM ci
4543
shell: bash
46-
env:
47-
CACHE_HIT: ${{steps.npm-cache.outputs.cache-hit}}
44+
if: steps.cache.outputs.cache-hit != 'true'
45+
run: npm ci

.github/scripts/cleanup-gh-pages.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ const TAG = 'cleanup-gh-pages:';
88
const removeOldFromPath = (isTag, data) => {
99
const path = `public/${isTag ? 'version' : 'review'}`;
1010
if (FS.existsSync(path) && data?.length > 0) {
11-
const dirsToDelete = FS.readdirSync(path).filter(
12-
(file) => !data.find((branch) => branch.name === file)
13-
);
11+
const dirsToDelete = FS.readdirSync(path)
12+
.filter((file) => !data.find((branch) => branch.name === file))
13+
.filter((file) => file !== 'main');
1414
if (dirsToDelete?.length > 0) {
1515
console.log(
1616
TAG,

.github/workflows/00-init.yml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,8 @@ jobs:
1515
uses: actions/checkout@v3
1616

1717
- name: 🔄 Init Cache Default
18-
id: "npm-cache"
1918
uses: ./.github/actions/npm-cache
2019

21-
- name: 🎄🥊 Log cache-hit
22-
run: echo $CACHE_HIT
23-
shell: bash
24-
env:
25-
CACHE_HIT: ${{steps.npm-cache.outputs.cache-hit}}
26-
27-
- name: 📥 Download deps default-npm-cache
28-
if: steps.npm-cache.outputs.cache-hit != 'true'
29-
uses: bahmutov/npm-install@v1
30-
3120
- name: 💀 Killing me softly
3221
uses: ./.github/actions/cancel-workflow
3322
if: failure()

0 commit comments

Comments
 (0)