safe #5662
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: 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: | |
- master | |
pull_request: | |
branches: | |
- master | |
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 | |
- shell: python | |
id: version | |
name: determine version | |
run: | | |
import yaml, os | |
def add_to_env_and_outputs(name, value): | |
for var in ('GITHUB_OUTPUT', 'GITHUB_ENV'): | |
with open(os.environ[var], 'a') as fh: | |
print(f'{name}={value}', file=fh) | |
with open('pyqgis_conf.yml', 'r') as f: | |
cfg = yaml.safe_load(f) | |
version_list = cfg['version_list'].replace(' ', '').split(',') | |
versions = { | |
'stable': version_list[1], | |
'ltr': cfg['current_ltr'], | |
'master': 'master' | |
} | |
version = versions['${{ matrix.qgis_version }}'] | |
versions_list = ','.join(versions.values()) | |
print(f'version: {version}') | |
print(f'versions list: {versions_list}') | |
add_to_env_and_outputs('QGIS_VERSION', version) | |
add_to_env_and_outputs('QGIS_VERSIONS_LIST', versions_list) | |
- name: Build PyQGIS docs | |
if: ${{ github.event_name != 'pull_request' || matrix.qgis_version == 'master' }} | |
env: | |
RUNS_ON_CI: true | |
run: | | |
echo "QGIS_VERSION: ${QGIS_VERSION}" | |
echo "BUILD_TESTING: ${BUILD_TESTING}" | |
./scripts/run-docker.sh | |
- uses: actions/upload-artifact@v4 | |
if: ${{ github.event_name != 'pull_request' || matrix.qgis_version == 'master' }} | |
with: | |
name: ${{ matrix.qgis_version }} | |
path: ./build/ | |
publish-docs: | |
name: Publish HTML | |
runs-on: ubuntu-latest | |
needs: build-docs | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get artifact for master | |
uses: actions/download-artifact@v4 | |
with: | |
name: master | |
path: html | |
- name: Get artifact for stable | |
if: ${{ github.event_name != 'pull_request' }} | |
uses: actions/download-artifact@v4 | |
with: | |
name: stable | |
path: html | |
- name: Get artifact for ltr | |
if: ${{ github.event_name != 'pull_request' }} | |
uses: actions/download-artifact@v4 | |
with: | |
name: ltr | |
path: html | |
- name: Push to git | |
env: | |
BUILD_TESTING: ${{ github.event_name == 'pull_request' && github.event.pull_request.number || false }} | |
VERSIONS: ${{ github.event_name == 'pull_request' && '("master")' || needs.build-docs.outputs.QGIS_VERSIONS_LIST }} | |
GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
run: | | |
if [[ ${PUBLISH} != "false" ]]; then | |
./scripts/publish-docs.sh ${VERSIONS} | |
fi |