-
-
Notifications
You must be signed in to change notification settings - Fork 63
73 lines (70 loc) · 3.68 KB
/
generate_documentation.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
73
name: Generate the documentation
on:
push:
tags:
- 'v*.*.*'
- '!v*.*.*d'
jobs:
build_manylinux:
name: Build for manylinux
runs-on: ubuntu-latest
container:
image: docker://quay.io/pypa/manylinux2014_x86_64
strategy:
max-parallel: 1
matrix:
language: [kr, en]
steps:
- uses: actions/checkout@v1
- name: Install dependencies
run: |
/opt/python/cp39-cp39/bin/python -m pip install --upgrade pip
yum install libffi-devel -y
git clone https://gitlab.com/libeigen/eigen
cd eigen
git checkout tags/3.4.0
cd ..
mkdir include
mv eigen/Eigen/ include/
git clone https://github.com/bab2min/EigenRand
cd EigenRand
git checkout tags/v0.4.1
cd ..
mv EigenRand/EigenRand include/
git clone https://github.com/mapbox/variant
cd variant
git checkout tags/v1.1.3
cd ..
mv variant/include/mapbox include/
- name: build
run: |
/opt/python/cp39-cp39/bin/python -m pip install numpy==`/opt/python/cp39-cp39/bin/python .github/workflows/numpy_version.py`
/opt/python/cp39-cp39/bin/python -m pip install pdoc3==0.8.4
export TOMOTOPY_LANG=${{ matrix.language }}
/opt/python/cp39-cp39/bin/python setup.py install
- name: gen doc
run: |
export TOMOTOPY_VER="`/opt/python/cp39-cp39/bin/python -m pip show tomotopy | grep Version | cut -d' ' -f2`"
export TOMOTOPY_LANG=${{ matrix.language }}
/opt/python/cp39-cp39/bin/python -m pdoc --html tomotopy
sed -i -E "s/documentation<\/title>/documentation (v${TOMOTOPY_VER})<\/title>/" html/tomotopy/*.html
sed -i -E 's/<\/title>/<\/title><link rel="icon" type="image\/png" sizes="192x192" href="\/tomotopy\/favicon-192x192.png">/' html/tomotopy/*.html
sed -i -E 's/(<p><img alt="" src="https:\/\/badge.fury.io\/py\/tomotopy.svg"><\/p>)/<script async defer src="https:\/\/buttons.github.io\/buttons.js"><\/script> <p><img alt="" src="https:\/\/badge.fury.io\/py\/tomotopy.svg"> <a class="github-button" href="https:\/\/github.com\/bab2min\/tomotopy" data-size="large" data-show-count="true" aria-label="Star bab2min\/tomotopy on GitHub">Star<\/a> <a class="github-button" href="https:\/\/github.com\/bab2min\/tomotopy\/issues" data-size="large" data-show-count="true" aria-label="Issue bab2min\/tomotopy on GitHub">Issue<\/a> <\/p>/' html/tomotopy/*.html
sed -i -e '/<nav id="sidebar">/r document/document_header.html' html/tomotopy/*.html
sed -i -E 's/(<\/body>)/<script async src="https:\/\/www.googletagmanager.com\/gtag\/js?id=UA-35651242-12"><\/script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag("js", new Date()); gtag("config", "UA-35651242-12"); <\/script>\n\1/' html/tomotopy/*.html
bash document/pdoc_localization.sh html/tomotopy/*.html
mkdir -p ../g
pushd ../g
git clone https://${{ secrets.ACCESS_TOKEN }}@github.com/bab2min/bab2min.github.io
mkdir -p bab2min.github.io/tomotopy/v${TOMOTOPY_VER}/${{ matrix.language }}
popd
cp -r html/tomotopy/* ../g/bab2min.github.io/tomotopy/v${TOMOTOPY_VER}/${{ matrix.language }}
pushd ../g/bab2min.github.io
echo "<meta http-equiv='refresh' content='0;url=/tomotopy/v${TOMOTOPY_VER}/en/' >" > tomotopy/index.html
echo "<meta http-equiv='refresh' content='0;url=/tomotopy/v${TOMOTOPY_VER}/kr/' >" > tomotopy/index.kr.html
git config user.email "[email protected]"
git config user.name "bab2min"
git add .
git commit -m "v${TOMOTOPY_VER} ${{ matrix.language }}"
git push
popd