Add GitHub Actions workflow for GitHub Pages deployment
Some checks failed
Deploy to GitHub Pages / build (push) Has been cancelled
Deploy to GitHub Pages / deploy (push) Has been cancelled

- Auto-deploy on push to main branch
- Manual trigger via workflow_dispatch
- Uses Node.js 20, npm ci for reproducible builds
- Deploys dist/ folder to GitHub Pages

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
gbanyan
2025-12-15 23:30:38 +08:00
parent 820679df66
commit 41333f74ad

View File

@@ -1,21 +1,28 @@
# Deploy to GitHub Pages
name: Deploy to GitHub Pages name: Deploy to GitHub Pages
on: on:
# Runs on pushes targeting the default branch
push: push:
branches: branches: ["main"]
- main
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch: workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions: permissions:
contents: read contents: read
pages: write pages: write
id-token: write id-token: write
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency: concurrency:
group: "pages" group: "pages"
cancel-in-progress: false cancel-in-progress: false
jobs: jobs:
# Build job
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@@ -25,8 +32,11 @@ jobs:
- name: Setup Node.js - name: Setup Node.js
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: '20' node-version: "20"
cache: 'npm' cache: "npm"
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Install dependencies - name: Install dependencies
run: npm ci run: npm ci
@@ -34,14 +44,12 @@ jobs:
- name: Build - name: Build
run: npm run build run: npm run build
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Upload artifact - name: Upload artifact
uses: actions/upload-pages-artifact@v3 uses: actions/upload-pages-artifact@v3
with: with:
path: 'dist' path: ./dist
# Deployment job
deploy: deploy:
environment: environment:
name: github-pages name: github-pages