Skip to content

Build and Deploy to GitHub Pages #266

Build and Deploy to GitHub Pages

Build and Deploy to GitHub Pages #266

name: Build and Deploy to GitHub Pages
on:
schedule:
- cron: '0 2 * * *'
push:
branches:
- 3.14
paths-ignore: []
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Python repository
uses: actions/checkout@v4
with:
repository: python/cpython
ref: v3.14.7
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.12'
- name: Setup virtual environment
run: make venv
working-directory: ./Doc
- name: Pin Sphinx to 9.1.0
run: ./venv/bin/pip install "sphinx==9.1.0"
working-directory: ./Doc
- name: Checkout translation files
uses: actions/checkout@v4
with:
path: Doc/locales/fa/LC_MESSAGES
- name: Strip fuzzy markers and compile .po to .mo
run: find Doc/locales/fa/LC_MESSAGES -name "*.po" -not -path "*/.git/*" | python3 Doc/locales/fa/LC_MESSAGES/scripts/compile_mo.py
env:
MSGFMT_TOOLS_PATH: Tools/i18n
- name: Setup problem matcher
uses: sphinx-doc/github-problem-matcher@v1.1
- name: Build documentation
run: make -e SPHINXERRORHANDLING="" SPHINXOPTS="--color -D language='fa' -D gettext_allow_fuzzy_translations=1 -D html_theme_options.is_rtl=true -D suppress_warnings=i18n.inconsistent_references --keep-going" html
working-directory: ./Doc
# ---- Glossary searcher build starts here ----
- name: Install glossary build dependencies
run: pip install -r glossary-searcher/scripts/requirements.txt
working-directory: Doc/locales/fa/LC_MESSAGES
- name: Build glossary corpus & glossary data
run: |
python glossary-searcher/scripts/build_corpus.py \
--repo-dir . \
--glossary-tsv glossary.tsv \
--out-dir glossary-searcher/data
working-directory: Doc/locales/fa/LC_MESSAGES
- name: Build glossary site
run: |
python glossary-searcher/scripts/build_site.py \
--site-dir glossary-searcher/site \
--data-dir glossary-searcher/data \
--out-dir glossary-searcher/dist
working-directory: Doc/locales/fa/LC_MESSAGES
- name: Merge glossary site into docs build
run: cp -r Doc/locales/fa/LC_MESSAGES/glossary-searcher/dist Doc/build/html/glossary-searcher
# ---- Glossary searcher build ends here ----
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: Doc/build/html
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4