Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Aug 2, 2025

This PR adds a GitHub Action workflow that automatically deploys the project documentation to GitHub Pages with support for custom build scripts to generate artifacts during deployment.

What this does

The new workflow (.github/workflows/deploy-docs.yml) will:

  • Trigger on every push to the main branch
  • Set up Node.js environment and install dependencies
  • Execute custom build scripts via npm run build:docs (if available)
  • Deploy the built documentation to the gh-pages branch
  • Enable automatic hosting of the project documentation website

Key Features

  • Custom Build Support: Runs npm run build:docs to allow generation of browser-compat JSON files and other artifacts before deployment
  • Flexible Configuration: Falls back gracefully if no build script is defined
  • Clean Deployments: Uses force_orphan: true to ensure clean deployments that overwrite the gh-pages branch completely
  • Reliable Deployment: Uses the proven peaceiris/actions-gh-pages@v3 action

Implementation Details

  • Sets up Node.js 18 with npm caching for fast builds
  • Installs dependencies with npm ci
  • Executes build scripts to generate documentation artifacts
  • Publishes the docs directory as-is after build
  • Uses GitHub's built-in GITHUB_TOKEN for authentication
  • Includes meaningful commit messages for deployment tracking

This enables automatic deployment of the project's comprehensive documentation website (including the main site, manual, API docs, and developer tools) with support for building dynamic content like browser compatibility data.

Fixes #183.


💬 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: yorkie <1935767+yorkie@users.noreply.github.com>
Copilot AI changed the title [WIP] Add GitHub Action to deploy docs to gh-pages on main branch commits Add GitHub Action to deploy docs to gh-pages on main branch commits Aug 2, 2025
Copilot AI requested a review from yorkie August 2, 2025 07:38
fetch-depth: 0

- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does this action support executing custom scripts, because later we need to build some json files into the gh-pages branch.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, the action now supports executing custom scripts! I've updated the workflow to include Node.js setup, dependency installation, and a configurable build step that runs npm run build:docs if available. This allows you to build browser-compat JSON files and other artifacts before deployment. See commit 9addf3c.

Copy link
Collaborator

@yorkie yorkie left a comment

Choose a reason for hiding this comment

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

Please support executing custom scripts on each deployment, because we need to build some artifacts such as browser-compat big JSON files to the gh-pages, too.

Co-authored-by: yorkie <1935767+yorkie@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Aug 2, 2025

Please support executing custom scripts on each deployment, because we need to build some artifacts such as browser-compat big JSON files to the gh-pages, too.

I've added support for executing custom scripts during deployment. The workflow now includes:

  • Node.js setup and npm dependency installation
  • A build step that runs npm run build:docs (if the script exists)
  • Fallback handling for repositories without the build script

You can now add your custom build commands to the build:docs script in package.json to generate browser-compat JSON files and other artifacts before each deployment. See commit 9addf3c.

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • registry.npmmirror.com
    • Triggering command: npm ci (dns block)
    • Triggering command: npm install (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title Add GitHub Action to deploy docs to gh-pages on main branch commits Add GitHub Action to deploy docs with custom build support to gh-pages Aug 2, 2025
Copilot AI requested a review from yorkie August 2, 2025 08:06
@yorkie yorkie marked this pull request as ready for review August 2, 2025 08:17
@yorkie yorkie merged commit d066440 into main Aug 2, 2025
2 checks passed
@yorkie yorkie deleted the copilot/fix-183 branch August 2, 2025 08:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add GitHub Action to deploy docs to gh-pages on main branch commits

2 participants