Repository navigation
56 lines (48 loc) · 1.84 KB
/
Copy path.install.yml
File metadata and controls
56 lines (48 loc) · 1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
name: .install
on:
workflow_call:
outputs:
node-modules-cache-key:
description: a max(stable) cache key to the node modules of this commit's dependencies
value: ${{ jobs.pnpm.outputs.node-modules-cache-key }}
jobs:
pnpm:
runs-on: ubuntu-24.04
outputs:
node-modules-cache-key: ${{ steps.cache.outputs.cache-primary-key }}
steps:
- name: checkout
uses: actions/checkout@v4
- name: node-modules deps hash
id: deps-hash
run: |
NODE_VERSION=$(cat .nvmrc | tr -d '[:space:]');
echo "NODE_VERSION=$NODE_VERSION"
echo "node-version=$NODE_VERSION" >> "$GITHUB_OUTPUT"
PACKAGE_DEPS_HASH=$(md5sum pnpm-lock.yaml | awk '{print $1}');
echo "PACKAGE_DEPS_HASH=$PACKAGE_DEPS_HASH"
echo "package-deps-hash=$PACKAGE_DEPS_HASH" >> "$GITHUB_OUTPUT"
- name: node-modules cache check
uses: actions/cache/restore@v4
id: cache
with:
path: ./node_modules
key: ${{ runner.os }}-node-${{ steps.deps-hash.outputs.node-version }}-pnpm-${{ steps.deps-hash.outputs.package-deps-hash }}
lookup-only: true
- name: node-modules cache miss setup node
if: steps.cache.outputs.cache-hit != 'true'
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
- name: node-modules cache miss setup pnpm
if: steps.cache.outputs.cache-hit != 'true'
uses: pnpm/action-setup@v4
- name: node-modules cache miss install
if: steps.cache.outputs.cache-hit != 'true'
run: pnpm install --frozen-lockfile
- name: node-modules cache set
if: steps.cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: ./node_modules
key: ${{ steps.cache.outputs.cache-primary-key }}