Skip to content

Sphinx Preview Build #53

Sphinx Preview Build

Sphinx Preview Build #53

Workflow file for this run

# 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, '#preview')
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: Install dependencies
uses: mamba-org/setup-micromamba@v1
with:
environment-file: environment.yaml
- name: Safe workflow for build preview
run: if [ -d "_build" ]; then rm -rf _build; fi
- name: Build page and Translations
if: contains(github.event.comment.body, '#preview')
run: |
make gettext html
- name: Create nojekyll file
run: |
touch _build/.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/fpm/pr/${{github.event.issue.number}}"