Skip to content

Website update

Website update #323

Workflow file for this run

name: "Website update"
on:
push:
branches:
- "**"
- "!gh-pages"
pull_request:
branches:
- main
schedule:
- cron: "0 1 * * MON"
workflow_dispatch:
jobs:
website:
runs-on: ubuntu-latest
steps:
- name: Clone website repository on current branch
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Clone website repository on stats branch
uses: actions/checkout@v4
with:
ref: stats
fetch-depth: 0
path: _build/stats
- name: Clone website repository on gh-pages branch
uses: actions/checkout@v4
with:
ref: gh-pages
fetch-depth: 0
path: _build/html
- name: Install dependencies
run: |
python3 -m pip -q install pandas plotly sphinx-material sphinxcontrib-bibtex
- name: Generate sphinx website
run: |
pushd _stats
ln -s ../_build/stats/stats.csv stats.csv
popd
rm -rf _build/html/* && python3 -m sphinx -W -b html . _build/html
- name: Fix permissions
run: |
sudo chown $USER _build -R
- name: Remove unnecessary .doctrees folder
run: |
rm -rf _build/html/.doctrees
- name: Check that no releases or notebooks have been deleted
run: |
pushd _build/html
if [[ $(git ls-files --deleted releases | wc -l) -gt 0 ]]; then
echo "The following releases have been deleted:"
git ls-files --deleted releases
exit 1
fi
if [[ $(git ls-files --deleted tests | wc -l) -gt 0 ]]; then
echo "The following notebooks have been deleted:"
git ls-files --deleted tests
exit 1
fi
popd
shell: bash
- name: Deploy to GitHub pages
if: github.repository == 'fem-on-colab/fem-on-colab.github.io' && github.ref == 'refs/heads/main'
run: |
SHA_SHORT=$(git rev-parse --short HEAD)
pushd _build/html
git config user.name "GitHub Actions"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add .
git pull origin gh-pages
[ -n "$(git status --porcelain=v1 2>/dev/null)" ] && git commit -m "deploy: ${SHA_SHORT}"
git push origin gh-pages
popd
shell: bash
- name: Deploy to GitHub artifacts
if: github.repository == 'fem-on-colab/fem-on-colab.github.io' && github.ref != 'refs/heads/main'
uses: actions/upload-artifact@v4
with:
name: website
path: |
_build/html
!_build/html/.git
retention-days: 1
warn:
runs-on: ubuntu-latest
if: github.repository == 'fem-on-colab/fem-on-colab.github.io' && github.ref == 'refs/heads/main' && github.event_name == 'schedule'
steps:
- name: Warn if scheduled workflow is about to be disabled
uses: fem-on-colab/warn-workflow-about-to-be-disabled-action@main
with:
workflow-filename: website.yml
days-elapsed: 50