diff --git a/.github/actions/cache-build/action.yml b/.github/actions/cache-build/action.yml index b5e1fe47f8..d3445a489a 100644 --- a/.github/actions/cache-build/action.yml +++ b/.github/actions/cache-build/action.yml @@ -7,7 +7,27 @@ inputs: runs: using: "composite" steps: + - name: Cache production build + uses: actions/cache@v4 + id: cache-build + env: + cache-name: prod-build + # Use branch name for cache scoping (head_ref for PRs, ref_name for pushes) + branch-key: ${{ github.head_ref || github.ref_name }} + # Hash yarn.lock for dependency changes + lockfile-hash: ${{ hashFiles('yarn.lock') }} + # Hash source files that affect the web build, excluding generated directories + # Excludes packages/prisma/{generated,client,zod}/* and packages/kysely/* which are generated by prisma generate + source-hash: ${{ hashFiles('apps/**/**.[jt]s', 'apps/**/**.[jt]sx', 'apps/**/*.json', 'apps/**/*.css', 'packages/**/**.[jt]s', 'packages/**/**.[jt]sx', 'packages/prisma/schema.prisma', 'packages/prisma/migrations/**/*.sql', '!**/node_modules/**', '!packages/prisma/generated/**', '!packages/prisma/client/**', '!packages/prisma/zod/**', '!packages/kysely/**') }} + with: + path: | + ${{ github.workspace }}/apps/web/.next + ${{ github.workspace }}/apps/web/public/embed + **/.turbo/** + **/dist/** + key: ${{ runner.os }}-${{ env.cache-name }}-${{ inputs.node_version }}-${{ env.branch-key }}-${{ env.lockfile-hash }}-${{ env.source-hash }} - run: | export NODE_OPTIONS="--max_old_space_size=8192" yarn build + if: steps.cache-build.outputs.cache-hit != 'true' shell: bash