Skip to content

Merge pull request #7 from CS3219-AY2425S1/gh-actions-patch-3 #4

Merge pull request #7 from CS3219-AY2425S1/gh-actions-patch-3

Merge pull request #7 from CS3219-AY2425S1/gh-actions-patch-3 #4

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:
# Checkout repository
- name: Checkout
uses: actions/checkout@v4
# Setup Node.js environment
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
# Restore cache based on lock files inside the frontend directory
- name: Restore cache
uses: actions/cache@v4
with:
path: frontend/node_modules
# Generate a cache key based on the lock file inside frontend directory
key: ${{ runner.os }}-node-${{ hashFiles('frontend/package-lock.json', 'frontend/yarn.lock') }}
restore-keys: |
${{ runner.os }}-node-
# Install dependencies inside the frontend directory
- name: Install dependencies
run: |
cd frontend
npm ci # or 'yarn install' if you're using Yarn
# Build the Next.js application
- name: Build the app
run: |
cd frontend
npm run build # or 'yarn build' if you're using Yarn
# Upload the built artifacts to be deployed to GitHub Pages
- name: Upload build output
uses: actions/upload-pages-artifact@v3
with:
path: frontend/out # Adjust if your Next.js output path differs
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