Merge pull request #995 from opengisch/update-mkdocs-tx-1412 #163
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: doc | |
on: | |
pull_request: | |
branches: | |
- master | |
paths: | |
- 'docs/**' | |
- '.github/workflows/doc.yml' | |
push: | |
branches: | |
- master | |
paths: | |
- 'docs/**' | |
- '.github/workflows/doc.yml' | |
workflow_dispatch: # useful for testing tx pushes | |
defaults: | |
run: | |
working-directory: docs | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
env: | |
TX_TOKEN: ${{ secrets.TX_TOKEN }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Checkout Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: Install Python requirements | |
run: | | |
pip install -r requirements.txt | |
pip install -r requirements-dev.txt | |
- name: Install Transifex client | |
run: | | |
curl -OL https://github.com/transifex/cli/releases/download/v1.6.10/tx-linux-amd64.tar.gz | |
tar -xvzf tx-linux-amd64.tar.gz | |
- name: Extract translatable content from mkdocs.yml config | |
run: ./scripts/mkdocs_tx.py create_source | |
- name: Configure Transifex | |
run: scripts/transifex_utils.py | |
env: | |
TX_TOKEN: ${{ secrets.TX_TOKEN }} | |
- name: Push source files to Transifex | |
if: ${{ github.event_name != 'pull_request' }} | |
run: ./tx push | |
env: | |
TX_TOKEN: ${{ secrets.TX_TOKEN }} | |
- name: Pull translations from Transifex | |
if: contains(fromJSON('["push", "workflow_dispatch"]'), github.event_name) || ${{ github.event_name == 'pull_request' && github.repository == 'opengisch/QgisModelBaker' }} | |
run: | | |
./tx pull --translations --all --minimum-perc 10 | |
./tx status | |
env: | |
TX_TOKEN: ${{ secrets.TX_TOKEN }} | |
- name: Translate Mkdocs config | |
if: contains(fromJSON('["push", "workflow_dispatch"]'), github.event_name) || ${{ github.event_name == 'pull_request' && github.repository == 'opengisch/QgisModelBaker' }} | |
run: | | |
./scripts/mkdocs_tx.py -s en update_config | |
./scripts/mkdocs_tx_commit.sh | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build documentation | |
run: mkdocs build | |
- uses: actions/upload-artifact@v4 | |
if: ${{ github.event_name == 'pull_request' }} | |
with: | |
name: docs | |
path: docs/site | |
if-no-files-found: error | |
- name: Deploy to GitHub Pages | |
if: contains(fromJSON('["push", "workflow_dispatch"]'), github.event_name) | |
run: mkdocs gh-deploy --force |