Skip to content

ci: optimize docs workflow - auto-deploy to separate branch#60

Merged
cc-hearts merged 2 commits into
mainfrom
ci/optimize-docs-workflow
Jun 23, 2026
Merged

ci: optimize docs workflow - auto-deploy to separate branch#60
cc-hearts merged 2 commits into
mainfrom
ci/optimize-docs-workflow

Conversation

@cc-hearts

Copy link
Copy Markdown
Member

Summary

Optimized the documentation workflow to automatically deploy docs to a separate docs branch, removing docs from the main codebase to reduce PR size and improve CI efficiency.

Changes

1. .gitignore - Exclude docs directory

  • Added docs to .gitignore

2. .github/workflows/doc.yaml - Optimized workflow

Key improvements:

  • Only runs on main branch push (not on PRs)
  • Added paths-ignore to skip unnecessary triggers
  • Added permissions for better security
  • Added timeout to prevent hanging jobs
  • Improved commit message with [skip ci] to avoid CI loops

Trigger conditions:

on:
  push:
    branches:
      - main
    paths-ignore:
      - 'docs/**'
      - 'README.md'
      - 'README_ZH.md'
      - 'CHANGELOG.md'
      - 'LICENSE'
      - '.github/**'

3. Removed docs from git tracking

  • Docs are now generated and deployed automatically by CI
  • No more docs changes in PRs

Benefits

Before

  • ❌ Every PR included large docs diffs (60+ files)
  • ❌ Docs workflow ran on every PR (wasted CI resources)
  • ❌ Manual docs management required

After

  • ✅ PRs are clean and focused on code changes
  • ✅ Docs auto-deploy only when main branch changes
  • ✅ Docs are always up-to-date via CI
  • ✅ Reduced PR review time

How it works

  1. Developer pushes code to main
  2. CI detects changes (ignores docs, README, etc.)
  3. Doc workflow runs:
    • Installs dependencies
    • Generates documentation
    • Deploys to docs branch automatically
  4. GitHub Pages (if configured) serves from docs branch

Breaking Changes

None. This is a CI/CD optimization only.

- Add docs/ to .gitignore to exclude from PRs
- Optimize doc.yaml to only run on main branch push
- Add paths-ignore to skip unnecessary triggers
- Add proper permissions and timeout
- Remove docs from git tracking (auto-generated by CI)
@cc-hearts cc-hearts merged commit 681d480 into main Jun 23, 2026
4 checks passed
@cc-hearts cc-hearts deleted the ci/optimize-docs-workflow branch June 23, 2026 08:33
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.

1 participant