Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 91 additions & 0 deletions .github/workflows/build-and-deploy.yml
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.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,5 @@ _build/
_migrated/
_sphinx/
_repo/
output/
*.log
96 changes: 79 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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>/`
Comment on lines +33 to +36
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

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
-- `-j auto`: Uses all available CPU cores for parallel builds
+- `-j 4`: Uses four parallel jobs (matches build.sh)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
**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>/`
**Build optimizations:**
- `--exclude-classes`: Skips class reference migration (faster, these are auto-generated)
- `-j 4`: Uses four parallel jobs (matches build.sh)
- Branch mapping: `master``latest/`, other branches → `<branch-name>/`
🤖 Prompt for AI Agents
In `@README.md` around lines 33 - 36, The README's Quick Build bullet incorrectly
states "-j auto"; update that bullet to match build.sh which now uses "-j 4"
(change the bullet text from "`-j auto`: Uses all available CPU cores for
parallel builds" to "`-j 4`: Uses 4 parallel jobs as configured in build.sh"),
and ensure any mention of parallel build flags references build.sh (e.g.,
build.sh's invocation or variable) so the documentation and the build script
stay in sync.


### 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
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Add a language to the “How it works” fenced block.
Markdownlint (MD040) flags code fences without a language.

✏️ Suggested fix
-```
+```text
 Push to branch → GitHub Actions builds (30 min) → Deploys to Cloudflare Pages
</details>

<!-- suggestion_start -->

<details>
<summary>📝 Committable suggestion</summary>

> ‼️ **IMPORTANT**
> Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

```suggestion
**How it works:**
🧰 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
In `@README.md` around lines 77 - 80, Update the fenced code block under the "How
it works:" section to include a language identifier (e.g., add "text" after the
opening triple backticks) so the block becomes ```text ... ```, which satisfies
markdownlint MD040; locate the fenced block with the content "Push to branch →
GitHub Actions builds (30 min) → Deploys to Cloudflare Pages" and add the
language token to the opening fence.


**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
Expand Down Expand Up @@ -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
Expand Down
Loading