gh-pages #1614
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: gh-pages | |
on: | |
pull_request: | |
branches: | |
- master | |
push: | |
branches: | |
- master | |
schedule: | |
- cron: '30 1 * * *' | |
workflow_dispatch: | |
jobs: | |
translations: | |
runs-on: ubuntu-latest | |
if: (github.event_name == 'schedule' && github.repository == 'opengisch/QField-docs') || (github.event_name != 'schedule') | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
cache: 'pip' | |
- name: Install Python requirements | |
run: | | |
pip install -r requirements.txt | |
pip install -r requirements-dev.txt | |
- name: Install Python requirements insiders | |
run: pip install -r requirements-insiders.txt | |
env: | |
MKDOCS_INSIDERS_TOKEN: ${{ secrets.MKDOCS_INSIDERS_TOKEN }} | |
- 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: ./utils/mkdocs_tx.py create_source | |
- name: Configure Transifex | |
run: ./utils/transifex_utils.py | |
env: | |
TX_TOKEN: ${{ secrets.TX_TOKEN }} | |
- name: Push source files to Transifex | |
if: contains(fromJSON('["push", "workflow_dispatch", "schedule"]'), github.event_name) | |
run: ./tx push | |
env: | |
TX_TOKEN: ${{ secrets.TX_TOKEN }} | |
- name: Get all languages | |
id: get_langs | |
uses: mikefarah/[email protected] | |
with: | |
cmd: yq '.plugins[] | .i18n.languages | select( . != null ) | map(.locale) | join(",")' mkdocs.yml | |
- name: Pull translations from Transifex | |
if: contains(fromJSON('["push", "workflow_dispatch", "schedule"]'), github.event_name) || ${{ github.event_name == 'pull_request' && github.repository == 'opengisch/QField-docs' }} | |
run: | | |
./tx pull -t -l ${{ steps.get_langs.outputs.result }} | |
./tx status | |
env: | |
TX_TOKEN: ${{ secrets.TX_TOKEN }} | |
- name: Translate Mkdocs config | |
if: contains(fromJSON('["push", "workflow_dispatch", "schedule"]'), github.event_name) || ${{ github.event_name == 'pull_request' && github.repository == 'opengisch/QField-docs' }} | |
run: | | |
./utils/mkdocs_tx.py -s en update_config | |
./utils/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: site | |
if-no-files-found: error | |
- name: Deploy to GitHub Pages | |
if: contains(fromJSON('["push", "workflow_dispatch", "schedule"]'), github.event_name) | |
run: mkdocs gh-deploy --force |