Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Aug 13, 2025

This PR adds a complete CI/CD pipeline using GitHub Actions to automate the build and deployment process for the GitHub 中文版 application.

Features

The workflow provides automated deployment with the following capabilities:

  • Triggers: Runs on push to any branch using comprehensive glob pattern (**)
  • Environment: Ubuntu latest with Node.js 22 and pnpm 10
  • Build Process:
    • Installs dependencies with pnpm i --frozen-lockfile
    • Builds the application with pnpm build (outputs to dist/ directory)
  • Branch-specific GitHub Pages Deployment: Automatically deploys built files to GitHub Pages using peaceiris/actions-gh-pages@v4, but only when pushing to the master branch to prevent unintended deployments from feature branches
  • Optional Vercel Deployment: Supports Vercel deployment when secrets are configured (VERCEL_TOKEN, VERCEL_ORG_ID, VERCEL_PROJECT_ID)

Key Safety Features

  • Controlled Production Deployment: GitHub Pages deployment is restricted to the master branch only, ensuring that feature branches and experimental code don't accidentally get deployed to production
  • Comprehensive Branch Coverage: The workflow runs on all branches for CI validation, but deployment is selective

Compatibility

The workflow is fully compatible with this project's setup:

  • Uses pnpm package manager (matches project configuration)
  • Builds to dist/ directory (confirmed working)
  • Supports modern WebCell v3 + TypeScript architecture

The deployment pipeline will now automatically publish the GitHub 中文版 application when changes are pushed to the master branch, while still providing CI validation for all branches.

Fixes #7.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Co-authored-by: TechQuery <19969570+TechQuery@users.noreply.github.com>
Copilot AI changed the title [WIP] 增加 GitHub actions 部署配置 Add GitHub Actions CI/CD workflow for automated deployment Aug 13, 2025
Copilot AI requested a review from TechQuery August 13, 2025 19:03
Copilot finished work on behalf of TechQuery August 13, 2025 19:03
on:
push:
branches:
- '*'
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- '*'
- '**'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated branch pattern to ** for better glob matching. (a89f2c0)


- uses: pnpm/action-setup@v4
with:
version: 9
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
version: 9
version: 10

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated pnpm version to 10. (a89f2c0)

Comment on lines 30 to 32
- name: Deploy to GitHub pages
uses: peaceiris/actions-gh-pages@v4
with:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot 此处加一个判断:在非主分支时不要部署到 GitHub pages。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added condition if: github.ref == 'refs/heads/master' to deploy to GitHub Pages only on the main branch. (a89f2c0)

…and add main branch check for GitHub Pages deployment

Co-authored-by: TechQuery <19969570+TechQuery@users.noreply.github.com>
Copilot AI changed the title Add GitHub Actions CI/CD workflow for automated deployment Add GitHub Actions CI/CD workflow with branch-specific deployment controls Aug 13, 2025
Copilot AI requested a review from TechQuery August 13, 2025 19:08
Copilot finished work on behalf of TechQuery August 13, 2025 19:08
@TechQuery TechQuery marked this pull request as ready for review August 13, 2025 19:16
@TechQuery TechQuery merged commit be8e9c4 into master Aug 13, 2025
1 check passed
@TechQuery TechQuery deleted the copilot/fix-7 branch August 13, 2025 19:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

增加 GitHub actions 部署配置

2 participants