build encukou/cpython:annotations-docutils #65
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
| run-name: build ${{ github.event.inputs.repository }}:${{ github.event.inputs.reference }} | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| reference: | |
| description: 'Commit reference from CPython repository' | |
| required: true | |
| default: '3.14' | |
| dist_version: | |
| description: 'Dist version (compatible with patchlevel.py output)' | |
| required: true | |
| default: '3.14' | |
| repository: | |
| description: 'Repository to checkout' | |
| required: false | |
| default: 'python/cpython' | |
| publish: | |
| description: 'Publish to GitHub Pages' | |
| required: false | |
| default: false | |
| permissions: | |
| contents: write | |
| jobs: | |
| build-html: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/setup-python@master | |
| with: | |
| python-version: 3 | |
| - uses: actions/checkout@master | |
| with: | |
| repository: ${{ github.event.inputs.repository }} | |
| ref: ${{ github.event.inputs.reference }} | |
| - run: make venv | |
| working-directory: ./Doc | |
| - run: make dist-html | |
| working-directory: ./Doc | |
| - uses: actions/upload-artifact@master | |
| if: always() | |
| with: | |
| name: docs-html.zip | |
| path: ./Doc/dist/python-${{ github.event.inputs.dist_version }}-docs-html.zip | |
| if-no-files-found: ignore | |
| - uses: actions/upload-artifact@master | |
| if: always() | |
| with: | |
| name: docs-html.tar.bz2 | |
| path: ./Doc/dist/python-${{ github.event.inputs.dist_version }}-docs-html.tar.bz2 | |
| if-no-files-found: ignore | |
| build-text: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/setup-python@master | |
| with: | |
| python-version: 3 | |
| - uses: actions/checkout@master | |
| with: | |
| repository: ${{ github.event.inputs.repository }} | |
| ref: ${{ github.event.inputs.reference }} | |
| - run: make venv | |
| working-directory: ./Doc | |
| - run: make dist-text | |
| working-directory: ./Doc | |
| - uses: actions/upload-artifact@master | |
| if: always() | |
| with: | |
| name: docs-text.zip | |
| path: ./Doc/dist/python-${{ github.event.inputs.dist_version }}-docs-text.zip | |
| if-no-files-found: ignore | |
| - uses: actions/upload-artifact@master | |
| if: always() | |
| with: | |
| name: docs-text.tar.bz2 | |
| path: ./Doc/dist/python-${{ github.event.inputs.dist_version }}-docs-text.tar.bz2 | |
| if-no-files-found: ignore | |
| build-texinfo: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/setup-python@master | |
| with: | |
| python-version: 3 | |
| - uses: actions/checkout@master | |
| with: | |
| repository: ${{ github.event.inputs.repository }} | |
| ref: ${{ github.event.inputs.reference }} | |
| - run: make venv | |
| working-directory: ./Doc | |
| - run: sudo apt-get update && sudo apt-get install -y texinfo | |
| - run: make dist-texinfo | |
| working-directory: ./Doc | |
| - uses: actions/upload-artifact@master | |
| if: always() | |
| with: | |
| name: docs-texinfo.zip | |
| path: ./Doc/dist/python-${{ github.event.inputs.dist_version }}-docs-texinfo.zip | |
| if-no-files-found: ignore | |
| - uses: actions/upload-artifact@master | |
| if: always() | |
| with: | |
| name: docs-texinfo.tar.bz2 | |
| path: ./Doc/dist/python-${{ github.event.inputs.dist_version }}-docs-texinfo.tar.bz2 | |
| if-no-files-found: ignore | |
| build-epub: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/setup-python@master | |
| with: | |
| python-version: 3 | |
| - uses: actions/checkout@master | |
| with: | |
| repository: ${{ github.event.inputs.repository }} | |
| ref: ${{ github.event.inputs.reference }} | |
| - run: make venv | |
| working-directory: ./Doc | |
| - run: make dist-epub | |
| working-directory: ./Doc | |
| - uses: actions/upload-artifact@master | |
| if: always() | |
| with: | |
| name: docs.epub | |
| path: ./Doc/dist/python-${{ github.event.inputs.dist_version }}-docs.epub | |
| if-no-files-found: ignore | |
| build-pdf: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/setup-python@master | |
| with: | |
| python-version: 3 | |
| - uses: actions/checkout@master | |
| with: | |
| repository: ${{ github.event.inputs.repository }} | |
| ref: ${{ github.event.inputs.reference }} | |
| - run: make venv | |
| working-directory: ./Doc | |
| - run: sudo apt-get update && sudo apt-get install -y latexmk texlive-xetex fonts-freefont-otf xindy librsvg2-bin | |
| - run: make dist-pdf | |
| working-directory: ./Doc | |
| - uses: actions/upload-artifact@master | |
| if: always() | |
| with: | |
| name: pdf-logs.zip | |
| path: | | |
| ./Doc/build/latex/*.log | |
| ./Doc/build/latex/*.tex | |
| - uses: actions/upload-artifact@master | |
| if: always() | |
| with: | |
| name: docs-pdf-a4.zip | |
| path: ./Doc/dist/python-${{ github.event.inputs.dist_version }}-docs-pdf-a4.zip | |
| if-no-files-found: ignore | |
| - uses: actions/upload-artifact@master | |
| if: always() | |
| with: | |
| name: docs-pdf-a4.tar.bz2 | |
| path: ./Doc/dist/python-${{ github.event.inputs.dist_version }}-docs-pdf-a4.tar.bz2 | |
| if-no-files-found: ignore | |
| build-pdf-rinoh: | |
| runs-on: ubuntu-latest | |
| continue-on-error: true | |
| steps: | |
| - uses: actions/setup-python@master | |
| with: | |
| python-version: 3 | |
| - uses: actions/checkout@master | |
| with: | |
| repository: ${{ github.event.inputs.repository }} | |
| ref: ${{ github.event.inputs.reference }} | |
| - run: make venv | |
| working-directory: ./Doc | |
| - run: ./venv/bin/pip install git+https://github.com/brechtm/rinohtype | |
| working-directory: ./Doc | |
| - run: ./venv/bin/sphinx-build -b rinoh . build/rinoh | |
| working-directory: ./Doc | |
| - uses: actions/upload-artifact@master | |
| if: always() | |
| with: | |
| name: docs-pdf-rinoh | |
| path: ./Doc/build/rinoh/ | |
| if-no-files-found: ignore | |
| publish: | |
| needs: [build-html, build-text, build-texinfo, build-epub, build-pdf, build-pdf-rinoh] | |
| if: ${{ !cancelled() && github.event.inputs.publish == 'true' }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout gh-pages branch | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: gh-pages | |
| path: gh-pages | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@master | |
| with: | |
| path: artifacts | |
| - name: Copy generated archives to gh-pages | |
| run: | | |
| mkdir -p gh-pages/3 | |
| cp artifacts/docs-pdf-a4.zip/python-${{ github.event.inputs.dist_version }}-docs-pdf-a4.zip gh-pages/3/ 2>/dev/null || true | |
| cp artifacts/docs-pdf-a4.tar.bz2/python-${{ github.event.inputs.dist_version }}-docs-pdf-a4.tar.bz2 gh-pages/3/ 2>/dev/null || true | |
| # HTML | |
| cp artifacts/docs-html.zip/python-${{ github.event.inputs.dist_version }}-docs-html.zip gh-pages/3/ 2>/dev/null || true | |
| cp artifacts/docs-html.tar.bz2/python-${{ github.event.inputs.dist_version }}-docs-html.tar.bz2 gh-pages/3/ 2>/dev/null || true | |
| # Text | |
| cp artifacts/docs-text.zip/python-${{ github.event.inputs.dist_version }}-docs-text.zip gh-pages/3/ 2>/dev/null || true | |
| cp artifacts/docs-text.tar.bz2/python-${{ github.event.inputs.dist_version }}-docs-text.tar.bz2 gh-pages/3/ 2>/dev/null || true | |
| # Texinfo | |
| cp artifacts/docs-texinfo.zip/python-${{ github.event.inputs.dist_version }}-docs-texinfo.zip gh-pages/3/ 2>/dev/null || true | |
| cp artifacts/docs-texinfo.tar.bz2/python-${{ github.event.inputs.dist_version }}-docs-texinfo.tar.bz2 gh-pages/3/ 2>/dev/null || true | |
| # EPUB | |
| cp artifacts/docs.epub/python-${{ github.event.inputs.dist_version }}-docs.epub gh-pages/3/ 2>/dev/null || true | |
| # PDF (rinohtype, experimental) | |
| cp artifacts/docs-pdf-rinoh/*.pdf gh-pages/3/ 2>/dev/null || true | |
| - name: Commit generated archives | |
| id: commit | |
| run: | | |
| cd gh-pages | |
| git config user.name github-actions | |
| git config user.email github-actions@github.com | |
| git add 3/python-${{ github.event.inputs.dist_version }}-docs-* 3/*.pdf || true | |
| if git diff --cached --quiet; then | |
| echo "No documentation archives to commit" | |
| echo "has_changes=false" >> $GITHUB_OUTPUT | |
| else | |
| git commit -m "Update documentation archives for ${{ github.event.inputs.dist_version }}" | |
| echo "has_changes=true" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Push commit | |
| if: steps.commit.outputs.has_changes == 'true' | |
| uses: ad-m/github-push-action@master | |
| with: | |
| branch: gh-pages | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| directory: gh-pages |