From 7bd1f9f17a601477e3660efd883cd0f393ba2778 Mon Sep 17 00:00:00 2001 From: Jim Daniels Wasswa Date: Fri, 6 Oct 2023 14:24:32 +0800 Subject: [PATCH] ci: add step to save cache --- .github/actions/invalidate_master_cache/action.yml | 11 +++++++++++ .github/actions/npm_install_from_cache/action.yml | 2 +- .github/workflows/release_staging.yml | 2 ++ 3 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 .github/actions/invalidate_master_cache/action.yml diff --git a/.github/actions/invalidate_master_cache/action.yml b/.github/actions/invalidate_master_cache/action.yml new file mode 100644 index 00000000..f568ba60 --- /dev/null +++ b/.github/actions/invalidate_master_cache/action.yml @@ -0,0 +1,11 @@ +name: invalidate_npm_cache +description: Invalidate the Master NPM cache +runs: + using: composite + steps: + - name: save_cache + uses: actions/cache/save@v3 + with: + path: |- + node_modules + key: ${{ build-master-cache-${{ hashFiles('./package-lock.json') }} diff --git a/.github/actions/npm_install_from_cache/action.yml b/.github/actions/npm_install_from_cache/action.yml index e2e0c2db..831a10eb 100644 --- a/.github/actions/npm_install_from_cache/action.yml +++ b/.github/actions/npm_install_from_cache/action.yml @@ -7,7 +7,7 @@ runs: id: cache-nodemodules uses: actions/cache/restore@v3 with: - key: v1-deps-{{ checksum "package-lock.json" }} + key: ${{ build-master-cache-${{ hashFiles('./package-lock.json') }} path: node_modules - name: Install npm dependencies if: steps.cache-nodemodules.outputs.cache-hit != 'true' diff --git a/.github/workflows/release_staging.yml b/.github/workflows/release_staging.yml index f4e2bf5f..9fc4699a 100644 --- a/.github/workflows/release_staging.yml +++ b/.github/workflows/release_staging.yml @@ -15,6 +15,8 @@ jobs: uses: ./.github/actions/setup_node - name: Install Dependencies uses: ./.github/actions/npm_install_from_cache + - name: Invalidate Cache + uses: ./.github/actions/invalidate_master_cache - name: Build uses: ./.github/actions/build with: