Skip to content

Commit

Permalink
Merge pull request #320 from QGIS-Contribution/docs/move-to-modern-gi…
Browse files Browse the repository at this point in the history
…thub-pages-workflow

docs: use new GitHub Pages workflow instead of gh-pages branch
  • Loading branch information
Guts authored Jan 19, 2024
2 parents eebb21f + 97bbf92 commit 2a85acd
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 6 deletions.
50 changes: 45 additions & 5 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ name: "📚 Documentation"

on:
push:
branches: [master]
branches:
- master
paths:
- ".github/workflows/documentation.yml"
- "docs/*/**"
Expand All @@ -12,9 +13,30 @@ on:
tags:
- "*"

pull_request:
branches:
- master
paths:
- ".github/workflows/documentation.yml"
- docs/**/*
- requirements/documentation.txt

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.9

# 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
Expand All @@ -26,9 +48,9 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: "pip"
cache-dependency-path: "requirements/documentation.txt"
python-version: ${{ env.PYTHON_VERSION }}

- name: Install dependencies
run: |
Expand All @@ -38,7 +60,25 @@ jobs:
- 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
run: |
python -m pip install -U ghp-import
ghp-import --force --no-history --no-jekyll --push docs/_build/html
id: deployment
if: github.event_name == 'push' && (startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/master')
uses: actions/deploy-pages@v4
1 change: 0 additions & 1 deletion requirements/documentation.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# ------------------------

furo>=2023.*
ghp-import>2.0,<2.2
myst-parser[linkify]>=2
sphinx-autobuild>=2021.*
sphinx-copybutton>=0.3,<1
Expand Down

0 comments on commit 2a85acd

Please sign in to comment.