Maintainance PR #701
This file contains 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
# Github action to build preview sphinx site and commit to gh-pages branch | |
# Built site is pushed to 'gh-pages' branch | |
# | |
name: Sphinx Preview Build | |
on: | |
issue_comment: | |
types: [created] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
if: github.event.issue.pull_request && contains(github.event.comment.body, '#build') | |
steps: | |
- name: Checkout pr/${{github.event.issue.number}} | |
uses: actions/checkout@v4 | |
- name: Fetch pr/${{github.event.issue.number}} | |
run: | | |
git fetch origin pull/${{github.event.issue.number}}/head:pr-${{github.event.issue.number}} | |
git checkout pr-${{github.event.issue.number}} | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
- name: Install sphinx | |
run: pip3 install --user -r requirements.txt | |
- name: Safe workflow for build preview | |
run: if [ -d "build" ]; then rm -Rf build; fi | |
- name: Build page | |
if: contains(github.event.comment.body, '#build_preview') | |
run: python3 build.py en | |
- name: Build page translations | |
if: contains(github.event.comment.body, '#build_translation') | |
run: python3 build.py | |
- run: touch build/html/.nojekyll | |
- name: Deploy documentation sphinx | |
uses: JamesIves/[email protected] | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
branch: gh-pages | |
target-folder: pr/${{github.event.issue.number}} | |
folder: build/html | |
clean: false | |
git-config-email: [email protected] | |
git-config-name: Fortran | |
- name: Comment on pull request | |
uses: peter-evans/create-or-update-comment@v4 | |
with: | |
issue-number: ${{github.event.issue.number}} | |
body: "This PR has been built with Sphinx and can be previewed at: https://fortran-lang.github.io/webpage/pr/${{github.event.issue.number}}" |