Skip to content

Commit

Permalink
ci: Add GH workflow to build docs site and deploy to GH pages.
Browse files Browse the repository at this point in the history
  • Loading branch information
junhaoliao committed Jan 2, 2025
1 parent a319816 commit 3ddc651
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/deploy-gh-pages.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: "deploy-github-pages"

on:
push:
branches: ["main"]

permissions: {}

concurrency:
group: "${{github.workflow}}-${{github.ref}}"

# Cancel in-progress jobs for efficiency
cancel-in-progress: true

jobs:
build:
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v4"
- uses: "actions/setup-node@v4"
with:
node-version: "22"
cache: "npm"
cache-dependency-path: "./docs/package-lock.json"

- run: "npm --prefix docs/ install"
- run: "npm --prefix docs/ run build"

- name: "Upload static files as artifact"
uses: "actions/upload-pages-artifact@v4"
with:
path: "./docs/build"

deploy:
needs: "build"
permissions:
# To deploy to Pages
pages: "write"

# To request a JWT from GitHub for certifying the origin of the deployment
id-token: "write"
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"

0 comments on commit 3ddc651

Please sign in to comment.