feat(ci): skip build if no source changes (cache build output by hash)
This commit is contained in:
@@ -23,22 +23,34 @@ jobs:
|
||||
with:
|
||||
node-version: '24'
|
||||
|
||||
- name: Hash source files
|
||||
id: hash-src
|
||||
run: echo "hash=$(find apps/dashboard-ui -type f \( -name '*.vue' -o -name '*.ts' -o -name '*.js' -o -name '*.css' -o -name '*.json' -o -name '*.html' \) | sort | xargs sha256sum | sha256sum | cut -d' ' -f1)" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- uses: actions/cache@v3
|
||||
id: cache-build
|
||||
with:
|
||||
path: apps/dashboard-ui/dist
|
||||
key: build-dashboard-${{ steps.hash-src.outputs.hash }}
|
||||
|
||||
- name: Hash package-lock
|
||||
id: hash-npm
|
||||
run: echo "hash=$(sha256sum apps/dashboard-ui/package-lock.json | cut -d' ' -f1)" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- uses: actions/cache@v3
|
||||
id: cache-npm
|
||||
with:
|
||||
path: |
|
||||
~/.npm
|
||||
path: ~/.npm
|
||||
key: npm-dashboard-${{ steps.hash-npm.outputs.hash }}
|
||||
restore-keys: npm-dashboard-
|
||||
|
||||
- name: Install
|
||||
if: steps.cache-build.outputs.cache-hit != 'true'
|
||||
working-directory: apps/dashboard-ui
|
||||
run: npm ci || npm install
|
||||
|
||||
- name: Build
|
||||
if: steps.cache-build.outputs.cache-hit != 'true'
|
||||
working-directory: apps/dashboard-ui
|
||||
run: npm run build
|
||||
|
||||
|
||||
Reference in New Issue
Block a user