Skip to content

Version 1.5.0 (#128) #176

Version 1.5.0 (#128)

Version 1.5.0 (#128) #176

Workflow file for this run

name: Deploy Next.js site to Pages
on:
push:
branches: ['main'] # Triggers on push to main
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Sets permissions needed for GitHub Pages deployment
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: 'pages'
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout
uses: actions/checkout@v4
# Set up Node.js environment
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '20'
# --- Enable Corepack and Prepare pnpm ---
- name: Enable Corepack
run: corepack enable
# Prepare/Activate pnpm using the version defined in package.json or latest
- name: Prepare pnpm
run: corepack prepare pnpm@latest --activate
# --- Explicitly cache pnpm dependencies ---
# Get the path to the pnpm store
- name: Get pnpm store path
id: pnpm-cache
shell: bash # Specify bash shell for the command
run: |
echo "STORE_PATH=$(pnpm store path)" >> "$GITHUB_OUTPUT"
# Cache the pnpm store path identified in the previous step
- name: Cache pnpm dependencies
uses: actions/cache@v4
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} # Use the determined store path
key: ${{ runner.os }}-node-${{ matrix.node-version }}-${{ hashFiles('**/pnpm-lock.yaml') }} # Cache key based on OS, Node version, and lockfile
restore-keys: |
${{ runner.os }}-node-${{ matrix.node-version }}-
${{ runner.os }}- # Fallback keys
# --- End of explicit caching steps ---
# Sets up GitHub Pages environment
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Install dependencies
# Use pnpm install --frozen-lockfile for deterministic install
run: pnpm install --frozen-lockfile
- name: Build with Next.js (Production Mode)
run: pnpm run build
env:
NODE_ENV: production
# Uploads the build artifact for deployment
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./out # Adjust path if your build output is elsewhere
# Deployment job depends on the build job
deploy:
environment:
name: github-pages # Specifies the deployment environment
url: ${{ steps.deployment.outputs.page_url }} # URL of the deployed site
runs-on: ubuntu-latest
needs: build # Ensures build job completes successfully before deployment starts
steps:
# Deploys the uploaded artifact to GitHub Pages
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4