Skip to content
name: Update GithubPages documentation
on:
workflow_dispatch:
release:
types: [published]
jobs:
generateGHPages:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install package
run: |
python -m pip install --upgrade pip setuptools
python -m pip install .
- name: Retain directories
run: |
cp -R utils/gh-pages ..
cp -R docs ..
cp -R emoji ../emoji_module
- name: Switch to branch gh-pages
run: |
git stash
git config --global user.name github-actions
git config --global user.email 41898282+github-actions[bot]@users.noreply.github.com
git fetch origin
if ! git checkout -b gh-pages origin/gh-pages; then
echo Create new orphan branch gh-pages;
git checkout --orphan gh-pages;
git rm -rf .;
fi;
- name: Install requirements
run: |
python -m pip install -r ../gh-pages/requirements.txt
python -m pip install -r ../docs/requirements.txt
- name: Generate HTML
run: |
python ../gh-pages/generatePages.py -minify
- name: Move emoji module in correct path for sphinx links
run: |
mkdir -p ../emoji/
mv ../emoji_module/* ../emoji/
- name: Generate sphinx
run: |
make --directory ../docs html
- name: Move files into repository
run: |
mv ../gh-pages/index.html .
mv ../gh-pages/all.html .
mv ../gh-pages/main.css .
mv ../gh-pages/main.js .
rm -R docs || true
mv ../docs/_build/html docs
touch .nojekyll
- name: git commit & push
run: |
git add index.html all.html main.css main.js docs .nojekyll
# Use "|| true" or "--allow-empty" otherwise the action fails for empty commits
git commit -m "Updated gh-pages" || true
git push -u origin gh-pages