forked from godotengine/godot-docs
-
Notifications
You must be signed in to change notification settings - Fork 24
ci: Add GitHub Actions workflow for Cloudflare Pages deployment #141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Arctis-Fireblight
merged 12 commits into
Redot-Engine:master
from
MichaelFisher1997:optimize-build-simplify
Feb 2, 2026
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
d8f3657
optimize: simplify build.sh and add documentation
MichaelFisher1997 ecd7f37
trigger: deploy to test Cloudflare Pages build
MichaelFisher1997 8bd0cac
build: trigger fresh Cloudflare Pages deployment
MichaelFisher1997 86ef67f
fix: use -j 4 instead of -j auto for consistent performance
MichaelFisher1997 c2fde3d
ci: add GitHub Actions workflow for Cloudflare Pages deployment
MichaelFisher1997 8481790
trigger: start GitHub Actions build
MichaelFisher1997 1b25f4d
ci: disable old CI workflow to prevent conflicts
MichaelFisher1997 ca3aa19
fix: add missing apiToken to Cloudflare Pages action
MichaelFisher1997 4ad6dfb
trigger: test new Cloudflare API token
MichaelFisher1997 1007ee0
ci: add caching and switch to wrangler-action
MichaelFisher1997 baa9df6
config: add wrangler.toml for Cloudflare Pages
MichaelFisher1997 eb241df
fix: deploy correct subdirectory based on branch name
MichaelFisher1997 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,91 @@ | ||
| name: Build and Deploy Documentation | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - master | ||
| - optimize-build-simplify | ||
| pull_request: | ||
| branches: | ||
| - master | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 120 | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: '3.11' | ||
| cache: 'pip' | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| pip install -r requirements.txt | ||
|
|
||
| - name: Cache migrated files | ||
| uses: actions/cache@v4 | ||
| id: cache-migrated | ||
| with: | ||
| path: _migrated | ||
| key: migrated-${{ hashFiles('**/*.rst', 'conf.py', 'migrate.py') }} | ||
|
|
||
| - name: Cache Sphinx doctrees | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: _sphinx/.doctrees | ||
| key: doctrees-${{ github.ref }}-${{ github.run_id }} | ||
| restore-keys: | | ||
| doctrees-${{ github.ref }}- | ||
| doctrees- | ||
|
|
||
| - name: Build documentation | ||
| run: | | ||
| export FULL_RUN=1 | ||
| bash build.sh | ||
| env: | ||
| FULL_RUN: 1 | ||
|
|
||
| - name: Upload build artifact | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: redot-docs-build | ||
| path: output/ | ||
| retention-days: 1 | ||
|
|
||
| deploy: | ||
| needs: build | ||
| runs-on: ubuntu-latest | ||
| if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/optimize-build-simplify') | ||
|
|
||
| steps: | ||
| - name: Download build artifact | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| name: redot-docs-build | ||
| path: output/ | ||
|
|
||
| - name: Determine deploy directory | ||
| run: | | ||
| if [ "${{ github.ref_name }}" = "master" ]; then | ||
| echo "DEPLOY_DIR=output/html/en/latest" >> $GITHUB_ENV | ||
| else | ||
| echo "DEPLOY_DIR=output/html/en/${{ github.ref_name }}" >> $GITHUB_ENV | ||
| fi | ||
|
|
||
| - name: Deploy to Cloudflare Pages | ||
| uses: cloudflare/wrangler-action@v3 | ||
| with: | ||
| apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | ||
| accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | ||
| command: pages deploy ${{ env.DEPLOY_DIR }} --project-name=redot-docs --branch=${{ github.ref_name }} |
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -54,4 +54,5 @@ _build/ | |
| _migrated/ | ||
| _sphinx/ | ||
| _repo/ | ||
| output/ | ||
| *.log | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,20 +16,75 @@ For mobile devices or e-readers, you can also download an ePub copy (updated eve | |
| [latest](https://download.redotengine.org/docs/redot-docs-epub-master.zip). Extract | ||
| the ZIP archive then open the `RedotEngine.epub` file in an e-book reader application. | ||
|
|
||
| ## Migrating | ||
| ## Building Documentation | ||
|
|
||
| We are transitioning from Godot to Redot. In this period, a temporary solution is available. | ||
| ### Quick Build (Local Development) | ||
|
|
||
| For local development, use the optimized build script: | ||
|
|
||
| ```bash | ||
| # Full build (includes migration + Sphinx) | ||
| FULL_RUN=1 ./build.sh | ||
|
|
||
| # The output will be in output/html/en/latest/ (for master branch) | ||
| # or output/html/en/<branch-name>/ (for other branches) | ||
| ``` | ||
| python migrate.py . _migrated True | ||
|
|
||
| **Build optimizations:** | ||
| - `--exclude-classes`: Skips class reference migration (faster, these are auto-generated) | ||
| - `-j auto`: Uses all available CPU cores for parallel builds | ||
| - Branch mapping: `master` → `latest/`, other branches → `<branch-name>/` | ||
|
|
||
| ### Manual Build | ||
|
|
||
| If you prefer manual control: | ||
|
|
||
| ```bash | ||
| # 1. Migrate (optional - skip for faster builds, use --exclude-classes) | ||
| python migrate.py --exclude-classes . _migrated | ||
|
|
||
| # 2. Build with Sphinx (auto-detect CPU cores) | ||
| sphinx-build -b html -j auto ./_migrated/ _build/html | ||
| ``` | ||
|
|
||
| After the docs are converted, you can build with | ||
| ### Architecture | ||
|
|
||
| **GitHub Actions + Cloudflare Pages (Current):** | ||
| - Source: This repository (`Redot-Engine/redot-docs`) | ||
| - Build: GitHub Actions runs `build.sh` (2-hour timeout vs Cloudflare's 20 minutes) | ||
| - Deploy: Built output pushed to Cloudflare Pages | ||
| - Output: `/output/html/en/<branch>/` | ||
| - Serve: Cloudflare Pages serves the built documentation | ||
|
|
||
| **Previous architectures (deprecated):** | ||
| 1. ~Two repos: `redot-docs` (source) → builds → pushes to `redot-docs-live` (deployment)~ | ||
| 2. ~Direct Cloudflare Pages build (hit 20-minute timeout limit)~ | ||
|
|
||
| ### GitHub Actions Workflow | ||
|
|
||
| The repository includes an automated workflow (`.github/workflows/build-and-deploy.yml`) that: | ||
|
|
||
| 1. **Builds on every push** to `master` or `optimize-build-simplify` | ||
| 2. **Runs on GitHub Actions** with a 2-hour timeout (vs Cloudflare's 20-minute limit) | ||
| 3. **Deploys automatically** to Cloudflare Pages using the official Cloudflare action | ||
|
|
||
| **Setup required:** | ||
|
|
||
| Add these secrets to your GitHub repository (Settings → Secrets and variables → Actions): | ||
| - `CLOUDFLARE_ACCOUNT_ID` - Your Cloudflare account ID | ||
| - `CLOUDFLARE_API_TOKEN` - API token with Cloudflare Pages:Edit permission | ||
|
|
||
| **How it works:** | ||
| ``` | ||
| sphinx-build -b html ./_migrated/ _build/html | ||
| Push to branch → GitHub Actions builds (30 min) → Deploys to Cloudflare Pages | ||
| ``` | ||
|
Comment on lines
+77
to
80
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add a language to the “How it works” fenced block. ✏️ Suggested fix-```
+```text
Push to branch → GitHub Actions builds (30 min) → Deploys to Cloudflare Pages🧰 Tools🪛 markdownlint-cli2 (0.20.0)[warning] 78-78: Fenced code blocks should have a language specified (MD040, fenced-code-language) 🤖 Prompt for AI Agents |
||
|
|
||
| **Benefits:** | ||
| - No 20-minute timeout limit | ||
| - Python dependencies cached between builds | ||
| - Automatic deployment on every push | ||
| - Works for both production (master) and preview branches | ||
|
|
||
| ## Theming | ||
|
|
||
| The Redot documentation uses the default `sphinx_rtd_theme` with many | ||
|
|
@@ -58,24 +113,31 @@ Here are some quick links to the areas you might be interested in: | |
|
|
||
| ### How to build with anaconda/miniconda | ||
|
|
||
| ``` | ||
| # 1) create env with Python 3.11 | ||
| **Recommended: Use the build script** | ||
| ```bash | ||
| # Setup environment (one-time) | ||
| conda create -n redot-docs python=3.11 -y | ||
|
|
||
| # 2) activate it | ||
| conda activate redot-docs | ||
| pip install -r requirements.txt | ||
|
|
||
| # Build documentation | ||
| FULL_RUN=1 ./build.sh | ||
|
|
||
| # 3) ensure pip is available (usually is) | ||
| conda install pip -y | ||
| # Output: output/html/en/latest/ | ||
| ``` | ||
|
|
||
| # 4) from the repo root, install requirements via pip | ||
| python -m pip install -r requirements.txt | ||
| **Manual build (if you need fine control):** | ||
| ```bash | ||
| # 1) Setup environment | ||
| conda create -n redot-docs python=3.11 -y | ||
| conda activate redot-docs | ||
| pip install -r requirements.txt | ||
|
|
||
| # 5) Migration | ||
| python migrate.py . _migrated True | ||
| # 2) Migrate (use --exclude-classes for faster builds) | ||
| python migrate.py --exclude-classes . _migrated | ||
|
|
||
| # 6) build the docs | ||
| sphinx-build -b html ./_migrated/ _build/html | ||
| # 3) Build with Sphinx (auto-detect CPU cores) | ||
| sphinx-build -b html -j auto ./_migrated/ _build/html | ||
| ``` | ||
|
|
||
| ## License | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sync the Quick Build optimization bullets with build.sh.
The script now uses
-j 4, but the doc still says-j auto.✏️ Suggested doc tweak
📝 Committable suggestion
🤖 Prompt for AI Agents