name: 'Yarn Build with Cache' description: 'Run yarn build using yarn cache' inputs: ref: description: 'The Git ref to checkout' required: true runs: using: "composite" steps: - name: Cache uses: buildjet/cache@v4 id: cache with: path: | **/node_modules .yarn key: ${{ runner.os }}-yarn-4.5.1-cache-${{ hashFiles('./yarn.lock') }} # Typically, the cache will be hit, but if there's a network error when # restoring the cache, let's run the install step ourselves. - name: Install dependencies if: steps.cache.outputs.cache-hit != 'true' shell: bash run: | yarn install CHANGES=$(git status -s --ignore-submodules) if [[ ! -z $CHANGES ]]; then echo "Changes found: $CHANGES" git diff exit 1 fi - name: Build shell: bash run: yarn build