CI: habilitar cache do Next.js (.next/cache) em GitHub Actions (quality-checks e deploy self-hosted) e preservar cache entre builds
This commit is contained in:
parent
d5a11d0536
commit
9b633bd8e0
2 changed files with 19 additions and 6 deletions
16
.github/workflows/ci-cd-web-desktop.yml
vendored
16
.github/workflows/ci-cd-web-desktop.yml
vendored
|
|
@ -169,16 +169,20 @@ jobs:
|
|||
# Remove desktop app to avoid pnpm touching its node_modules on this runner
|
||||
rm -rf apps/desktop || true
|
||||
|
||||
- name: Clean Next.js cache (.next) to avoid EACCES
|
||||
- name: Ensure Next.js cache directory exists and is writable
|
||||
run: |
|
||||
cd "$EFFECTIVE_APP_DIR"
|
||||
if [ -e .next ]; then
|
||||
echo "Removing existing .next (may be root-owned from previous container)"
|
||||
rm -rf .next || (mv .next ".next.old.$(date +%s)" || true)
|
||||
fi
|
||||
mkdir -p .next
|
||||
mkdir -p .next/cache
|
||||
chmod -R u+rwX .next || true
|
||||
|
||||
- name: Cache Next.js build cache (.next/cache)
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ${{ env.EFFECTIVE_APP_DIR }}/.next/cache
|
||||
key: ${{ runner.os }}-nextjs-${{ hashFiles('pnpm-lock.yaml') }}-${{ hashFiles('src/**/*.ts', 'src/**/*.tsx', 'src/**/*.js', 'src/**/*.jsx', 'next.config.ts') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-nextjs-${{ hashFiles('pnpm-lock.yaml') }}-
|
||||
|
||||
- name: Install and build (Next.js)
|
||||
run: |
|
||||
cd "$EFFECTIVE_APP_DIR"
|
||||
|
|
|
|||
9
.github/workflows/quality-checks.yml
vendored
9
.github/workflows/quality-checks.yml
vendored
|
|
@ -36,6 +36,15 @@ jobs:
|
|||
- name: Install dependencies
|
||||
run: pnpm install --frozen-lockfile
|
||||
|
||||
- name: Cache Next.js build cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
${{ github.workspace }}/.next/cache
|
||||
key: ${{ runner.os }}-nextjs-${{ hashFiles('pnpm-lock.yaml') }}-${{ hashFiles('**/*.{js,jsx,ts,tsx}') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-nextjs-${{ hashFiles('pnpm-lock.yaml') }}-
|
||||
|
||||
- name: Generate Prisma client
|
||||
run: pnpm prisma:generate
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue