HomeDisk/.github/workflows/website.yml

71 lines
1.7 KiB
YAML

name: Website
on:
push:
branches:
- main
paths:
- 'website/**'
pull_request:
paths:
- 'website/**'
workflow_dispatch:
jobs:
build:
name: Next.js Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
- name: Install pnpm
uses: pnpm/action-setup@v2
id: pnpm-install
with:
version: 7
run_install: false
- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"
- name: Cache pnpm
uses: actions/cache@v3
with:
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('website/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Cache Next.js
uses: actions/cache@v3
with:
path: |
${{ github.workspace }}/website/.next/cache
key: ${{ runner.os }}-nextjs-${{ hashFiles('website/pnpm-lock.yaml') }}-${{ hashFiles('website/**.[jt]s', 'website/**.[jt]sx') }}
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('website/pnpm-lock.yaml') }}-
- name: Install dependencies
run: pnpm install --prefix website
- name: Build page
run: pnpm --prefix website run build
- name: Export page
run: pnpm --prefix website run export
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: website-static
path: website/out/**