GitHub Pages #1487
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
name: GitHub Pages | |
on: | |
schedule: | |
- cron: '0 9 * * *' | |
push: | |
branches: [main] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Install Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: "3.9" | |
architecture: "x64" | |
- name: Install dependencies | |
run: python -m pip install "sphinx<7.2.0" sphinx-material recommonmark "sphinx-markdown-tables>=0.0.17" requests pytest-check-links | |
- name: Check links | |
run: | | |
cp extensions.tpl extensions.md | |
pytest --check-links --ignore=_templates/ | |
rm extensions.md | |
- name: Build website | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
export SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct) | |
export TIME_STAMP=$(date -d"@${SOURCE_DATE_EPOCH}" --iso-8601=seconds) | |
make clean | |
make html | |
git checkout -b gh-pages | |
cp -rf _build/html/* docs/ | |
git config --global user.name "${GITHUB_ACTOR}" | |
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com" | |
git add docs | |
export msg="Updating website for commit ${GITHUB_SHA} made on ${TIME_STAMP} from ${GITHUB_REF} by ${GITHUB_ACTOR}" | |
git commit -am "${msg}" | |
git push origin gh-pages --force |