|
| 1 | +name: docs |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + tags: |
| 8 | + - 'v*.*' |
| 9 | + - 'v*.*.*' |
| 10 | + |
| 11 | +jobs: |
| 12 | + test: |
| 13 | + runs-on: ubuntu-latest |
| 14 | + strategy: |
| 15 | + matrix: |
| 16 | + python-version: [ '3.8' ] |
| 17 | + language: [ 'en', 'zh' ] |
| 18 | + steps: |
| 19 | + - name: Checkout source code |
| 20 | + uses: actions/checkout@v1 |
| 21 | + - name: Set up Python |
| 22 | + uses: actions/setup-python@v1 |
| 23 | + with: |
| 24 | + python-version: ${{ matrix.python-version }} |
| 25 | + - name: virtualenv cache |
| 26 | + uses: actions/cache@preview |
| 27 | + with: |
| 28 | + path: ~/.cache/pypoetry/virtualenvs |
| 29 | + key: ${{ runner.os }}-${{ matrix.python-version }}-poetry-${{ hashFiles(format('{0}{1}', github.workspace, '/poetry.lock')) }} |
| 30 | + restore-keys: | |
| 31 | + ${{ runner.os }}-${{ matrix.python-version }}-poetry- |
| 32 | + - name: Install Python dependencies |
| 33 | + run: | |
| 34 | + curl -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py | python |
| 35 | + $HOME/.poetry/bin/poetry install |
| 36 | + - name: Download latest translations |
| 37 | + if: matrix.language != 'en' |
| 38 | + run: | |
| 39 | + $HOME/.poetry/bin/poetry run sphinx-intl create-transifexrc |
| 40 | + $HOME/.poetry/bin/poetry run make -C docs -e LOC="${{ matrix.language }}" pull |
| 41 | + env: |
| 42 | + SPHINXINTL_TRANSIFEX_USERNAME: api |
| 43 | + SPHINXINTL_TRANSIFEX_PASSWORD: ${{ secrets.TRANSIFEX_TOKEN }} |
| 44 | + LOC: ${{ matrix.language }} |
| 45 | + - name: Build the documentation |
| 46 | + run: | |
| 47 | + $HOME/.poetry/bin/poetry run make -C docs -e SPHINXOPTS="-D language='${{ matrix.language }}'" html |
| 48 | + - name: Publish to GitHub Pages |
| 49 | + uses: fantix/ghaction-github-pages@master |
| 50 | + with: |
| 51 | + repo: python-gino/python-gino.org |
| 52 | + target_branch: master |
| 53 | + target_path: docs/${{ matrix.language }}/${{ github.ref }} |
| 54 | + keep_history: true |
| 55 | + allow_empty_commit: false |
| 56 | + build_dir: docs/_build/html |
| 57 | + commit_message: Update docs/${{ matrix.language }}/${{ github.ref }} @ ${{ github.sha }} |
| 58 | + env: |
| 59 | + GITHUB_PAT: ${{ secrets.GITHUB_PAT }} |
0 commit comments