From 51b7384be4b83845abdfd1e32cb0c5dae0b723e9 Mon Sep 17 00:00:00 2001 From: Fred C Date: Thu, 14 Mar 2024 16:25:18 +0100 Subject: [PATCH] Update documentation.yml --- .github/workflows/documentation.yml | 115 ++++++++++++++-------------- 1 file changed, 56 insertions(+), 59 deletions(-) diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index aa58d07..d3de709 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -1,87 +1,84 @@ -name: "📚 Documentation Builder" +name: "📚 Documentation" on: push: - branches: [ master ] + branches: + - master paths: - - '.github/workflows/documentation.yml' - - 'docs/**/*' - - 'requirements/documentation.txt' + - ".github/workflows/documentation.yml" + - "docs/*/**" + - "plugin_qgis_lpo/**/*.py" + - "plugin_qgis_lpo/metadata.txt" + - "requirements/documentation.txt" tags: - "*" pull_request: - branches: [ master ] + branches: + - master paths: - ".github/workflows/documentation.yml" + - docs/**/* + - requirements/documentation.txt -# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages -permissions: - contents: read - pages: write - id-token: write + workflow_dispatch: -# Allow one concurrent deployment +# Allow one concurrent deployment per branch/pr concurrency: - group: "pages" + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true env: PYTHON_VERSION: 3.9 +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write jobs: - build-docs: - + build: runs-on: ubuntu-latest steps: - - name: Get source code - uses: actions/checkout@v3 + - name: Get source code + uses: actions/checkout@v4 - - name: Set up Python - uses: actions/setup-python@v4 - with: + - name: Set up Python + uses: actions/setup-python@v5 + with: cache: "pip" cache-dependency-path: "requirements/documentation.txt" python-version: ${{ env.PYTHON_VERSION }} - - name: Cache Sphinx cache - uses: actions/cache@v4 - with: - path: docs/_build/cache - key: ${{ runner.os }}-sphinx-${{ hashFiles('docs/**/*') }} - restore-keys: | - ${{ runner.os }}-sphinx- - - - name: Install project requirements - run: | - python -m pip install -U pip setuptools wheel - python -m pip install -U -r requirements/documentation.txt - - - name: Build doc using Sphinx - run: sphinx-build -b html -j auto -d docs/_build/cache -q 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/master' ) }} - - - name: Upload artifact - uses: actions/upload-pages-artifact@v3 - if: ${{ github.event_name == 'push' && ( startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/master' ) }} - with: - # Upload entire repository - 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/master' ) }} - uses: actions/deploy-pages@v1 + - name: Install dependencies + run: | + python -m pip install --upgrade pip setuptools wheel + python -m pip install -U -r requirements/documentation.txt + + - name: Build doc using Sphinx + 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/master') + + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + if: github.event_name == 'push' && (startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/master') + 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/master') + uses: actions/deploy-pages@v4