Skip to content

Merge pull request #3 from lahiruudayakumara/main #6

Merge pull request #3 from lahiruudayakumara/main

Merge pull request #3 from lahiruudayakumara/main #6

Workflow file for this run

name: Deploy Next.js site to Pages
on:
push:
branches: ["main"]
workflow_dispatch:
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
# Install pnpm
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9
# Setup Node with pnpm caching
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
# Setup GitHub Pages
- name: Setup Pages
uses: actions/configure-pages@v5
with:
static_site_generator: next
# Restore Next.js build cache
- name: Restore Next.js cache
uses: actions/cache@v4
with:
path: .next/cache
key: ${{ runner.os }}-nextjs-${{ hashFiles('pnpm-lock.yaml') }}-${{ hashFiles('**/*.ts', '**/*.tsx') }}
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('pnpm-lock.yaml') }}-
# Install deps using pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
# Build Next.js
- name: Build with Next.js
run: pnpm next build
# Upload the ".next" static output folder
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./out
deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4