Skip to content

Commit

Permalink
Split modules and build artifact caches
Browse files Browse the repository at this point in the history
  • Loading branch information
WhiteHoodHacker authored Nov 1, 2024
1 parent 3b94110 commit 4fa47bd
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions .github/actions/build-astro/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,31 +31,44 @@ runs:
cache: npm
cache-dependency-path: ${{ inputs.working-directory }}/package-lock.json

- name: Restore cached build artifacts and node modules
- name: Restore cached node modules
id: cache-modules
uses: actions/cache@v4
env:
cache-name: cache-modules
with:
path: |
${{ inputs.working-directory }}/node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles(format('{0}/**/package-lock.json', inputs.working-directory)) }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Restore cached build artifacts
id: cache-build
uses: actions/cache@v4
env:
cache-name: cache-build-and-modules
cache-name: cache-build
with:
path: |
${{ inputs.working-directory }}/.astro
${{ inputs.working-directory }}/${{ inputs.cache-directory }}
${{ inputs.working-directory }}/${{ inputs.build-directory }}
${{ inputs.working-directory }}/node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles(format('{0}/**/package-lock.json', inputs.working-directory)) }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- if: ${{ steps.cache-build.outputs.cache-hit != 'true' }}
- if: ${{ steps.cache-modules.outputs.cache-hit != 'true' }}
name: (On cache miss) List the state of node modules
continue-on-error: true
run: npm list
shell: bash
working-directory: ${{ inputs.working-directory }}

- if: ${{ steps.cache-build.outputs.cache-hit != 'true' }}
- if: ${{ steps.cache-modules.outputs.cache-hit != 'true' }}
name: (On cache miss) Install node modules
continue-on-error: true
run: npm ci
Expand Down

0 comments on commit 4fa47bd

Please sign in to comment.