Fanu2's picture
Deploy full app to HF Space
b456468
name: 'Build'
description: 'Build package'
inputs:
ROOT_CACHE_KEY:
description: 'Key of root dependencies cache'
required: true
BUILD_CACHE_KEY:
description: 'Key of build cache'
required: true
runs:
using: 'composite'
steps:
- name: Use Node.js 15.x
uses: actions/setup-node@v1
with:
node-version: '15.x'
registry-url: https://registry.npmjs.org/
- name: Check root dependencies cache
uses: actions/cache@v2
with:
path: ./node_modules
key: ${{ inputs.ROOT_CACHE_KEY }}
- name: Install package dependencies and remove package-lock file
working-directory: ./apps/image-editor
run: |
npm install && rm -rf ./package-lock.json
shell: bash
- name: Check build cache
uses: actions/cache@v2
id: cache_built_packages
with:
path: ./apps/image-editor/dist
key: ${{ inputs.BUILD_CACHE_KEY }}
- name: Build package
working-directory: ./apps/image-editor
run: |
if echo ${{ steps.cache_built_packages.outputs.cache-hit }} | grep -c "true"
then
echo "Cache hit - skipping building"
else
npm run build
fi
shell: bash