13
13
runs-on :ubuntu-latest
14
14
15
15
steps :
16
+ -name :Prepare environment variables
17
+ run :|
18
+ ref=${GITHUB_REF#refs/pull/}
19
+ pr_num=${ref%/merge}
20
+
21
+ echo "::set-env name=PR_BUILD_ID::${GITHUB_BASE_REF}/${pr_num}"
22
+ echo "::set-env name=DOCS_BASE_DIR::build/html"
23
+ echo "::set-env name=DOCS_OUTPUT_DIR::${DOCS_BASE_DIR}/${PR_BUILD_ID}"
24
+
16
25
-name :Checkout cpython repository
17
26
uses :actions/checkout@v2
18
27
with :
@@ -38,22 +47,25 @@ jobs:
38
47
sudo apt-get update
39
48
sudo apt-get install -y --no-install-recommends python3-venv
40
49
41
- -name :Buildand publish doc
50
+ -name :Builddocs
42
51
run :|
43
- ref=${GITHUB_REF#refs/pull/}
44
- pr_num=${ref%/merge}
45
- output_dir=build/html/${{ github.base_ref }}/${pr_num}
46
-
47
52
cd cpython/Doc
48
53
make venv
49
- rm -rf ${output_dir }
50
- make build ALLSPHINXOPTS="-b html -D language=ja -D gettext_compact=0 -E -d build/doctrees . ${{ github.workspace }}/${output_dir }"
51
- ls -l ${{ github.workspace }}/${output_dir }
54
+ rm -rf ${DOCS_OUTPUT_DIR }
55
+ make build ALLSPHINXOPTS="-b html -D language=ja -D gettext_compact=0 -E -d build/doctrees . ${{ github.workspace }}/${DOCS_OUTPUT_DIR }"
56
+ ls -l ${{ github.workspace }}/${DOCS_OUTPUT_DIR }
52
57
53
- cd ${{ github.workspace }}/build/html
58
+ -name :Publish docs
59
+ cd ${{ github.workspace }}/${DOCS_BASE_DIR}
54
60
git config --local user.name "Autobuild bot on GitHub Actions"
55
61
git config --local user.email "githubaction-build-bot@example.com"
56
62
git add .
57
63
if [ $(git status -s | wc -l) -eq 0 ]; then echo "nothing to commit"; exit 0; fi
58
64
git commit -m 'update html'
59
65
git push "https://${{ github.token }}@github.com/${{ github.repository }}.git" gh-pages:gh-pages
66
+
67
+ -name :Notify the URL of the built docs
68
+ uses :thollander/actions-comment-pull-request@master
69
+ with :
70
+ message :" Please check the built documentation!!! https://python.github.io/python-docs-ja/${PR_BUILD_ID}"
71
+ GITHUB_TOKEN :${{ secrets.GITHUB_TOKEN }}