build PyQGIS API docs #5835
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: build PyQGIS API docs | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: false | |
on: | |
schedule: | |
# runs once a week | |
- cron: '0 0 * * 0' | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
permissions: | |
contents: write | |
pages: write | |
id-token: write | |
jobs: | |
build-docs: | |
name: Build PyQGIS docs | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
qgis_version: [ 'master', 'stable', 'ltr' ] | |
outputs: | |
QGIS_VERSIONS_LIST: ${{ steps.version.outputs.QGIS_VERSIONS_LIST }} | |
steps: | |
- uses: actions/checkout@v4 | |
- id: version | |
name: determine version | |
run: | | |
wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O yq && chmod +x yq | |
QGIS_CURRENT_LTR=$(yq .current_ltr pyqgis_conf.yml) | |
QGIS_CURRENT_STABLE=$(yq .current_stable pyqgis_conf.yml) | |
QGIS_VERSION=${{ matrix.qgis_version }} | |
if [[ "${QGIS_VERSION}" != 'master' ]]; then | |
QGIS_VERSION=$(yq --exit-status .current_${{ matrix.qgis_version }} pyqgis_conf.yml) | |
fi | |
vars=("QGIS_VERSION" "QGIS_CURRENT_STABLE" "QGIS_CURRENT_LTR") | |
for var in "${vars[@]}"; do | |
echo "${var}=${!var}" | |
echo "${var}=${!var}" >> "$GITHUB_OUTPUT" | |
echo "${var}=${!var}" >> "$GITHUB_ENV" | |
done | |
- name: Build PyQGIS docs | |
if: ${{ github.event_name != 'pull_request' || matrix.qgis_version == 'master' }} | |
run: | | |
./scripts/run-docker.sh -v ${QGIS_VERSION} | |
- uses: actions/upload-artifact@v4 | |
if: ${{ github.event_name != 'pull_request' || matrix.qgis_version == 'master' }} | |
with: | |
name: ${{ matrix.qgis_version }} | |
path: ./build | |
if-no-files-found: error | |
- name: Create archive | |
if: ${{ github.event_name != 'pull_request' || matrix.qgis_version == 'master' }} | |
run: zip -r pyqgis-docs-${{ env.QGIS_VERSION }}.zip ./build | |
- name: Release | |
uses: softprops/action-gh-release@v2 | |
if: ${{ github.event_name != 'pull_request' && matrix.qgis_version != 'master' }} | |
with: | |
tag_name: ${{ env.QGIS_VERSION }} | |
files: pyqgis-docs-${{ env.QGIS_VERSION }}.zip | |
deploy-docs: | |
if: ${{ github.event_name != 'pull_request' }} | |
name: Deploy to Github pages | |
runs-on: ubuntu-latest | |
needs: build-docs | |
steps: | |
- name: Get artifact for master | |
uses: actions/download-artifact@v4 | |
with: | |
name: master | |
merge-multiple: true | |
- name: Get artifact for stable | |
if: ${{ github.event_name != 'pull_request' }} | |
uses: actions/download-artifact@v4 | |
with: | |
name: stable | |
merge-multiple: true | |
- name: Get artifact for ltr | |
if: ${{ github.event_name != 'pull_request' }} | |
uses: actions/download-artifact@v4 | |
with: | |
name: ltr | |
merge-multiple: true | |
- uses: actions/configure-pages@v5 | |
- name: Deploy | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: . | |
- name: Deploy to GitHub Pages | |
uses: actions/deploy-pages@v4 |