-
-
Notifications
You must be signed in to change notification settings - Fork 32
72 lines (60 loc) · 2.26 KB
/
pr_build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
name: PR build for ver 3.8
on:
pull_request:
branches: [ "3.9" ]
types:
- opened # open PR
- synchronize # update the branch which pulled from
- reopened # re-open PR
jobs:
pr_build:
runs-on: ubuntu-latest
steps:
- name: Prepare environment variables
run: |
ref=${GITHUB_REF#refs/pull/}
pr_num=${ref%/merge}
echo "::set-env name=PR_BUILD_ID::${GITHUB_BASE_REF}/${pr_num}"
echo "::set-env name=DOCS_BASE_DIR::build/html"
echo "::set-env name=DOCS_OUTPUT_DIR::build/html/${GITHUB_BASE_REF}/${pr_num}"
- name: Checkout cpython repository
uses: actions/checkout@v2
with:
repository: python-doc-ja/cpython-doc-catalog
ref: catalog-3.8
path: cpython
- name: Checkout PR branch
uses: actions/checkout@v2
with:
ref: ${{ github.ref }}
path: cpython/Doc/locales/ja/LC_MESSAGES
- name: Checkout GitHub Pages
uses: actions/checkout@v2
with:
ref: gh-pages
path: build/html
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends python3-venv
- name: Build docs
run: |
cd cpython/Doc
make venv
rm -rf ${DOCS_OUTPUT_DIR}
make build ALLSPHINXOPTS="-b html -D language=ja -D gettext_compact=0 -E -d build/doctrees . ${GITHUB_WORKSPACE}/${DOCS_OUTPUT_DIR}"
ls -l ${GITHUB_WORKSPACE}/${DOCS_OUTPUT_DIR}
- name: Publish docs
run: |
cd ${GITHUB_WORKSPACE}/${DOCS_BASE_DIR}
git config --local user.name "Autobuild bot on GitHub Actions"
git config --local user.email "[email protected]"
git add .
if [ $(git status -s | wc -l) -eq 0 ]; then echo "nothing to commit"; exit 0; fi
git commit -m 'update html'
git push --quiet "https://${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git" gh-pages:gh-pages
- name: Notify the URL of the built docs
uses: thollander/actions-comment-pull-request@master
with:
message: 'Please check the built documentation!!! https://python.github.io/python-docs-ja/${{ env.PR_BUILD_ID }}'
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}