From 41333f74ad7b1aa8b5fb9b5fc2313ffa4361a1a3 Mon Sep 17 00:00:00 2001 From: gbanyan Date: Mon, 15 Dec 2025 23:30:38 +0800 Subject: [PATCH] Add GitHub Actions workflow for GitHub Pages deployment MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 --- .github/workflows/deploy.yml | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 08848b6..6be80ea 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,21 +1,28 @@ +# Deploy to GitHub Pages name: Deploy to GitHub Pages on: + # Runs on pushes targeting the default branch push: - branches: - - main + branches: ["main"] + + # Allows you to run this workflow manually from the Actions tab workflow_dispatch: +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages permissions: contents: read pages: 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: group: "pages" cancel-in-progress: false jobs: + # Build job build: runs-on: ubuntu-latest steps: @@ -25,8 +32,11 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: '20' - cache: 'npm' + node-version: "20" + cache: "npm" + + - name: Setup Pages + uses: actions/configure-pages@v4 - name: Install dependencies run: npm ci @@ -34,14 +44,12 @@ jobs: - name: Build run: npm run build - - name: Setup Pages - uses: actions/configure-pages@v4 - - name: Upload artifact uses: actions/upload-pages-artifact@v3 with: - path: 'dist' + path: ./dist + # Deployment job deploy: environment: name: github-pages