Skip to content

Deploy to GitHub Pages #4

Deploy to GitHub Pages

Deploy to GitHub Pages #4

Workflow file for this run

name: Deploy to GitHub Pages
on:
push:
branches: [ main, master ]
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: true
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'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build (Static Export)
run: npm run build
env:
NEXT_PUBLIC_BASE_PATH: /people/wang_hao
- name: Re-root export under basePath
run: |
rm -rf out_tmp
mv out out_tmp
mkdir -p out/people/wang_hao
cp -r out_tmp/* out/people/wang_hao/
# keep .nojekyll at root and subdir for safety
cp -f out_tmp/.nojekyll out/.nojekyll || true
cp -f out_tmp/.nojekyll out/people/wang_hao/.nojekyll || true
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: out
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4