diff --git a/.github/workflows/deploy_docs_ghpages.yml b/.github/workflows/deploy_docs_ghpages.yml new file mode 100644 index 000000000..06947ad2f --- /dev/null +++ b/.github/workflows/deploy_docs_ghpages.yml @@ -0,0 +1,65 @@ +--- +name: 'deploy_docs_ghpages' + +on: + push: + tags: + - 0.* + workflow_dispatch: + inputs: + branch: + description: Branch to run on + default: 0.x + required: true + +permissions: + contents: write + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - name: Cloning repo + uses: actions/checkout@v7 + with: + fetch-depth: 0 + ref: ${{ github.event.inputs.branch }} + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.x' + + - name: Install Sphinx and theme + run: pip install sphinx furo + + - name: Build docs + run: | + sphinx-build -b html -c docs/gh-pages docs/en _site + touch _site/.nojekyll + + - name: Deploy to gh-pages (docs/ subpath) + run: | + set -euo pipefail + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + + # Check out the existing gh-pages branch in a separate worktree so we + # only touch the docs/ subpath and leave the root landing page, + # CNAME, and .nojekyll intact. + git fetch origin gh-pages + git worktree add gh-pages-publish origin/gh-pages + + # Replace docs/ wholesale so renamed/removed pages don't linger. + rm -rf gh-pages-publish/docs + mkdir -p gh-pages-publish/docs + cp -R _site/. gh-pages-publish/docs/ + + cd gh-pages-publish + git add docs + if git diff --cached --quiet; then + echo "No documentation changes to publish." + exit 0 + fi + git commit -m "Deploy docs to gh-pages/docs (${GITHUB_SHA})" + git push origin HEAD:gh-pages diff --git a/docs/gh-pages/conf.py b/docs/gh-pages/conf.py new file mode 100644 index 000000000..caabd38c3 --- /dev/null +++ b/docs/gh-pages/conf.py @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- +# +# Standalone Sphinx configuration for the GitHub Pages build. +# +# Unlike docs/en/conf.py (which pulls in the CakePHP docs theme via +# cakephpsphinx for the apps.cakephp.org deployment), this config produces a +# self-contained, vanilla Sphinx site using the Furo theme. It is published to +# the `docs/` subpath of the `gh-pages` branch by +# .github/workflows/deploy_docs_ghpages.yml. +# +# Build with: +# sphinx-build -b html -c docs/gh-pages docs/en + +project = 'Phinx' +copyright = '2012, Rob Morgan' +author = 'Rob Morgan' + +# Keep in sync with docs/config/all.py +release = '0.16' +version = '0.16' + +extensions = [] + +# contents.rst holds the root toctree (index.rst is marked :orphan:). +root_doc = 'contents' + +source_suffix = '.rst' +language = 'en' + +exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] + +# -- HTML output ------------------------------------------------------------- + +html_theme = 'furo' +html_title = 'Phinx Documentation' + +html_theme_options = { + 'source_repository': 'https://github.com/cakephp/phinx', + 'source_branch': '0.x', + 'source_directory': 'docs/en/', +}