main-doc #11
This file contains hidden or 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
# This is a basic workflow to help you get started with Actions | |
name: main-doc | |
# Controls when the action will run. | |
on: | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
sphinx: | |
# Build docs and upload to GH Pages | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.9 | |
- name: Checkout main branch | |
# checkout mvtb repo into workspace | |
uses: actions/checkout@v4 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install .[docs] | |
# install the data package | |
cd mvtb-data | |
python -m pip install . | |
# doc tools | |
python -m pip install git+https://github.com/petercorke/sphinx-autorun.git | |
sudo apt-get install graphviz | |
- name: Build docs | |
run: | | |
cd docs | |
make html | |
# Tell GitHub not to use jekyll to compile the docs | |
touch build/html/.nojekyll | |
- name: Commit documentation changes | |
run: | | |
git clone https://github.com/petercorke/machinevision-toolbox-python.git --branch gh-pages --single-branch gh-pages | |
cp -r docs/build/html/* gh-pages/ | |
cd gh-pages | |
git config --local user.email "action@github.com" | |
git config --local user.name "GitHub Action" | |
git add . | |
git commit -m "Update documentation" -a || true | |
# The above command will fail if no changes were present, so we ignore | |
# that. | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
branch: gh-pages | |
directory: gh-pages | |
github_token: ${{ secrets.GITHUB_TOKEN }} |