Bump next from 14.2.4 to 14.2.21 #70
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy Next.js site to Pages | |
on: | |
push: | |
branches: ["master"] | |
workflow_dispatch: | |
pull_request: | |
branches: ["master"] | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
concurrency: | |
group: "pages" | |
cancel-in-progress: false | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "20" | |
- name: Install pnpm | |
uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
run_install: false | |
- name: Setup Pages | |
uses: actions/configure-pages@v5 | |
with: | |
static_site_generator: next | |
- name: Get pnpm store directory | |
shell: bash | |
run: | | |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | |
- name: Restore pnpm cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
${{ env.STORE_PATH }} | |
.next/cache | |
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/pnpm-lock.yaml') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }} | |
restore-keys: | | |
${{ runner.os }}-nextjs-${{ hashFiles('**/pnpm-lock.yaml') }}- | |
- name: Install dependencies | |
run: pnpm install --no-frozen-lockfile | |
# Add these steps for image processing | |
- name: Create necessary directories | |
run: | | |
mkdir -p content/images | |
mkdir -p public/images | |
- name: Process images | |
run: pnpm blog process-images || true # Continue even if no images to process | |
- name: Build with Next.js | |
run: pnpm build | |
- name: Preserve Focus app files | |
run: | | |
if [ -d ".next/static" ]; then | |
echo "Backing up Focus app files..." | |
mkdir -p focus-backup | |
[ -d "public/focus" ] && cp -r public/focus/* focus-backup/ | |
fi | |
- name: Static HTML export with Next.js | |
run: pnpm export | |
- name: Restore Focus app files | |
run: | | |
if [ -d "focus-backup" ]; then | |
echo "Restoring Focus app files..." | |
mkdir -p out/focus | |
cp -r focus-backup/* out/focus/ | |
rm -rf focus-backup | |
fi | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: ./out | |
deploy: | |
environment: | |
name: ${{ github.event_name == 'pull_request' && format('preview-{0}', github.event.number) || 'github-pages' }} | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
needs: build | |
if: ${{ github.event_name == 'pull_request' || github.ref == 'refs/heads/master' }} | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |