From afb83441d2f62e3f7294fb20c8e451989dc769f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Bournhonesque?= Date: Mon, 20 Nov 2023 18:16:55 +0100 Subject: [PATCH] chore: add github workflow to generate doc --- .github/workflows/generate-docs.yml | 64 +++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 .github/workflows/generate-docs.yml diff --git a/.github/workflows/generate-docs.yml b/.github/workflows/generate-docs.yml new file mode 100644 index 00000000..29e08c11 --- /dev/null +++ b/.github/workflows/generate-docs.yml @@ -0,0 +1,64 @@ +#---------------------------------------------- +# Generate and upload documentation (only on push to main) +#---------------------------------------------- + + name: Generate documentation + on: + pull_request: + # on pull request we just want to build to see nothing is broken + paths: + - "docs/**" + - ".github/workflows/generate-docs.yml" + - "mkdocs.yml" + push: + branches: + - main + + jobs: + publish-docs: + runs-on: ubuntu-20.04 + strategy: + matrix: + python-version: [3.11] + steps: + - name: Check out the repo + uses: actions/checkout@v3 + + - name: Setup Python version + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Install Poetry + uses: snok/install-poetry@v1.3 + with: + virtualenvs-create: true + virtualenvs-in-project: true + + - name: Load cached venv + id: cached-poetry-dependencies + uses: actions/cache@v3 + with: + path: .venv + key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }} + + - name: Install dependencies + run: poetry install + if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' + + - name: Generate documentation + run: bash ./build_mkdocs.sh + + # Deploy docs to gh_pages if we are pushing to main + # Example from https://github.com/marketplace/actions/deploy-to-github-pages + - name: Deploy 🚀 + # we only deploy on push to main + if: | + github.event_name == 'push' && github.event.ref == 'refs/heads/main' + uses: JamesIves/github-pages-deploy-action@v4.4.1 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + BRANCH: gh-pages # The branch the action should deploy to. + FOLDER: gh_pages # The folder the action should deploy. + CLEAN: true # Automatically remove deleted files from the deploy branch + \ No newline at end of file