Merge pull request #405 from PnX-SI/dev #5
Workflow file for this run
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: "📚 Documentation" | |
on: | |
push: | |
branches: | |
- master | |
paths: | |
- ".github/workflows/documentation.yml" | |
- "docs/*/**" | |
tags: | |
- "*" | |
pull_request: | |
branches: | |
- master | |
paths: | |
- ".github/workflows/documentation.yml" | |
- docs/**/* | |
workflow_dispatch: | |
# Allow one concurrent deployment per branch/pr | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
env: | |
PYTHON_VERSION: 3.11 | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get source code | |
uses: actions/checkout@v4 | |
- name: Run image | |
uses: abatilo/actions-poetry@v3 | |
#------------------------------------ | |
# ----- Install dependencies ----- | |
#------------------------------------ | |
- name: Install dependencies | |
run: | | |
cd backend | |
poetry install --only=docs | |
- name: Build doc using Sphinx | |
run: | | |
cd backend | |
poetry run sphinx-build -b html -d ../docs/_build/cache -j auto ../docs ../docs/_build/html | |
- name: Save build doc as artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: documentation | |
path: docs/_build/html/* | |
if-no-files-found: error | |
retention-days: 30 | |
- name: Setup Pages | |
uses: actions/configure-pages@v4 | |
if: github.event_name == 'push' && (startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main') | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v3 | |
if: github.event_name == 'push' && (startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main') | |
with: | |
path: docs/_build/html/ | |
- name: Deploy to GitHub Pages | |
id: deployment | |
if: github.event_name == 'push' && (startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main') | |
uses: actions/deploy-pages@v4 |