From fbd0da08db0d6010f4dba94b82b921012c4dfc8d Mon Sep 17 00:00:00 2001 From: Robert Lyn <43123823+RobertLynJA@users.noreply.github.com> Date: Mon, 14 Nov 2022 00:36:33 -0500 Subject: [PATCH] Cache node modules (#30) * Add cache for node modules * Add cache dependency to build * Add cache dependency to prod deployment --- .github/workflows/{dotnet.yml => build.yml} | 11 ++++++++++- .github/workflows/deploy-dev.yml | 10 ++++++++++ .github/workflows/deploy-prod.yml | 9 +++++++++ 3 files changed, 29 insertions(+), 1 deletion(-) rename .github/workflows/{dotnet.yml => build.yml} (71%) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/build.yml similarity index 71% rename from .github/workflows/dotnet.yml rename to .github/workflows/build.yml index e67551c..b64dd62 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: .NET +name: Build on: push @@ -18,6 +18,15 @@ jobs: uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} + - name: Cache node modules + id: cache-npm + uses: actions/cache@v3 + env: + cache-name: cache-node-modules + with: + # npm cache files are stored in `~/.npm` on Linux/macOS + path: ~/.npm + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} - name: BuildUI run: | npm install --prefix web diff --git a/.github/workflows/deploy-dev.yml b/.github/workflows/deploy-dev.yml index 03ac73d..3b0978e 100644 --- a/.github/workflows/deploy-dev.yml +++ b/.github/workflows/deploy-dev.yml @@ -22,6 +22,16 @@ jobs: uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} + - name: Cache node modules + id: cache-npm + uses: actions/cache@v3 + env: + cache-name: cache-node-modules + with: + # npm cache files are stored in `~/.npm` on Linux/macOS + path: ~/.npm + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + - name: BuildUI run: | npm install --prefix web diff --git a/.github/workflows/deploy-prod.yml b/.github/workflows/deploy-prod.yml index 932b740..0d197e0 100644 --- a/.github/workflows/deploy-prod.yml +++ b/.github/workflows/deploy-prod.yml @@ -21,6 +21,15 @@ jobs: uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} + - name: Cache node modules + id: cache-npm + uses: actions/cache@v3 + env: + cache-name: cache-node-modules + with: + # npm cache files are stored in `~/.npm` on Linux/macOS + path: ~/.npm + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} - name: BuildUI run: | npm install --prefix web