|
| 1 | +name: "📚 Documentation" |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + paths: |
| 8 | + - ".github/workflows/documentation.yml" |
| 9 | + - "docs/*/**" |
| 10 | + tags: |
| 11 | + - "*" |
| 12 | + |
| 13 | + pull_request: |
| 14 | + branches: |
| 15 | + - master |
| 16 | + paths: |
| 17 | + - ".github/workflows/documentation.yml" |
| 18 | + - docs/**/* |
| 19 | + |
| 20 | + workflow_dispatch: |
| 21 | + |
| 22 | +# Allow one concurrent deployment per branch/pr |
| 23 | +concurrency: |
| 24 | + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} |
| 25 | + cancel-in-progress: true |
| 26 | + |
| 27 | +env: |
| 28 | + PYTHON_VERSION: 3.11 |
| 29 | + |
| 30 | +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages |
| 31 | +permissions: |
| 32 | + contents: read |
| 33 | + pages: write |
| 34 | + id-token: write |
| 35 | + |
| 36 | +jobs: |
| 37 | + build: |
| 38 | + runs-on: ubuntu-latest |
| 39 | + |
| 40 | + steps: |
| 41 | + - name: Get source code |
| 42 | + uses: actions/checkout@v4 |
| 43 | + |
| 44 | + - name: Run image |
| 45 | + uses: abatilo/actions-poetry@v3 |
| 46 | + #------------------------------------ |
| 47 | + # ----- Install dependencies ----- |
| 48 | + #------------------------------------ |
| 49 | + - name: Install dependencies |
| 50 | + run: | |
| 51 | + cd backend |
| 52 | + poetry install --only=docs |
| 53 | +
|
| 54 | + - name: Build doc using Sphinx |
| 55 | + run: | |
| 56 | + cd backend |
| 57 | + poetry run sphinx-build -b html -d ../docs/_build/cache -j auto ../docs ../docs/_build/html |
| 58 | +
|
| 59 | + - name: Save build doc as artifact |
| 60 | + uses: actions/upload-artifact@v4 |
| 61 | + with: |
| 62 | + name: documentation |
| 63 | + path: docs/_build/html/* |
| 64 | + if-no-files-found: error |
| 65 | + retention-days: 30 |
| 66 | + |
| 67 | + - name: Setup Pages |
| 68 | + uses: actions/configure-pages@v4 |
| 69 | + if: github.event_name == 'push' && (startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main') |
| 70 | + |
| 71 | + - name: Upload artifact |
| 72 | + uses: actions/upload-pages-artifact@v3 |
| 73 | + if: github.event_name == 'push' && (startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main') |
| 74 | + with: |
| 75 | + path: docs/_build/html/ |
| 76 | + |
| 77 | + - name: Deploy to GitHub Pages |
| 78 | + id: deployment |
| 79 | + if: github.event_name == 'push' && (startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main') |
| 80 | + uses: actions/deploy-pages@v4 |
0 commit comments