Skip to content

Commit 79e7d4c

Browse files
committed
add docs Action
1 parent 1756020 commit 79e7d4c

File tree

2 files changed

+68
-1
lines changed

2 files changed

+68
-1
lines changed

.github/workflows/docs.yml

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
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 }}

.github/workflows/test.yml

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
name: test
22

3-
on: [push]
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- v*.*.x
8+
pull_request:
9+
branches:
10+
- master
11+
- v*.*.x
412

513
jobs:
614
test:

0 commit comments

Comments
 (0)