1010 description : ' CD | TAG | MANUAL'
1111 required : false
1212 default : MANUAL
13+ build_old_docs :
14+ description : ' Whether to build old docs (TRUE | FALSE)'
15+ type : string
16+ default : ' FALSE'
17+ package :
18+ description : The name of the repo to build documentation for.
19+ type : string
20+ default : docarray
21+ repo_owner :
22+ description : The owner of the repo to build documentation for. Defaults to 'jina-ai'.
23+ type : string
24+ default : jina-ai
25+ pages_branch :
26+ description : Branch that Github Pages observes
27+ type : string
28+ default : gh-pages
29+ git_config_name :
30+ type : string
31+ default : Jina Dev Bot
32+ git_config_email :
33+ type : string
34+ 1335
1436jobs :
1537 token-check :
@@ -20,20 +42,18 @@ jobs:
2042 env :
2143 release_token : ${{ secrets.DOCARRAY_RELEASE_TOKEN }}
2244
23- release -docs :
45+ build-and-push-latest -docs :
2446 needs : token-check
2547 runs-on : ubuntu-latest
2648 steps :
27- - uses : actions/checkout@v2.5.0
49+ - uses : actions/checkout@v3
2850 with :
29- fetch-depth : 0
51+ fetch-depth : 1
3052 - uses : actions/setup-python@v4
3153 with :
32- python-version : 3.7
33- - name : Build doc and push to gh-pages
54+ python-version : ' 3.7'
55+ - name : Install Dependencies
3456 run : |
35- git config --local user.email "[email protected] " 36- git config --local user.name "Jina Dev Bot"
3757 python -m pip install --upgrade pip
3858 python -m pip install wheel
3959 # pip does not properly resolve dependency versions with syntax pip install --no-cache-dir ".[test,full]"
@@ -44,28 +64,52 @@ jobs:
4464 pip install --no-cache-dir ".[weaviate]"
4565 pip install --no-cache-dir ".[elasticsearch]"
4666 pip install --no-cache-dir ".[redis]"
47- mkdir gen-html
4867 cd docs
4968 pip install -r requirements.txt
5069 pip install --pre -U furo
70+ pip install sphinx-markdown-tables==0.0.17
71+ - name : Sphinx Build
72+ run : |
73+ cd docs
5174 bash makedoc.sh
52- cd ./_build/dirhtml/
53- cp -r ./ ../../../gen-html
54- cd - # back to ./docs
55- cd ..
56- git checkout -f gh-pages
57- git rm -rf ./docs
58- mkdir -p docs
59- cd gen-html
60- cp -r ./ ../docs
61- cd ../docs
62- ls -la
63- touch .nojekyll
64- cp 404/index.html 404.html
65- sed -i 's/href="\.\./href="/' 404.html # fix asset urls that needs to be updated in 404.html
66- echo docarray.jina.ai > CNAME
67- cd ..
68- git add docs
69- git status
70- git commit -m "chore(docs): update docs due to ${{github.event_name}} on ${{github.repository}}"
71- git push --force origin gh-pages
75+ mv ./_build/dirhtml /tmp/gen-html
76+ - name : Checkout to GH pages branch (${{ inputs.pages_branch }})
77+ run : |
78+ git fetch origin ${{ inputs.pages_branch }}:${{ inputs.pages_branch }} --depth 1
79+ git checkout -f ${{ inputs.pages_branch }}
80+ git reset --hard HEAD
81+ - name : Small config stuff
82+ run : |
83+ touch /tmp/gen-html/.nojekyll
84+ cp ./docs/CNAME /tmp/gen-html/CNAME
85+ cp ./docs/_versions.json /tmp/gen-html/_versions.json
86+ cp /tmp/gen-html/404/index.html /tmp/gen-html/404.html
87+ sed -i 's/href="\.\./href="/' /tmp/gen-html/404.html # fix asset urls that needs to be updated in 404.html
88+ - name : Moving old doc versions
89+ run : |
90+ cd docs
91+ for i in $(cat _versions.json | jq '.[].version' | tr -d '"'); do mv "$i" /tmp/gen-html; done
92+ - name : Swap in new docs
93+ run : |
94+ rm -rf ./docs
95+ mv /tmp/gen-html ./docs
96+ - name : Push it up!
97+ run : |
98+ git config --local user.email "${{ inputs.git_config_email }}"
99+ git config --local user.name "${{ inputs.git_config_name }}"
100+ git show --summary
101+ git add ./docs && git commit -m "chore(docs): update docs due to ${{github.event_name}} on ${{github.repository}}"
102+ git push origin ${{ inputs.pages_branch }}
103+
104+ build-old-docs :
105+ needs : build-and-push-latest-docs
106+ runs-on : ubuntu-latest
107+ if : inputs.build_old_docs == 'TRUE'
108+ steps :
109+ - uses : benc-uk/workflow-dispatch@v1
110+ with :
111+ workflow : Build old docs
112+ token : ${{ secrets.JINA_DEV_BOT }}
113+ inputs : ' { "release_token": "${{ env.release_token }}", "triggered_by": "TAG"}'
114+ env :
115+ release_token : ${{ secrets.DOCARRAY_RELEASE_TOKEN }}
0 commit comments