-
Notifications
You must be signed in to change notification settings - Fork 33
49 lines (47 loc) · 1.66 KB
/
github-actions-doc-options-update.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
name: Doc auto generation
on:
push:
branches: [master]
jobs:
Explore-GitHub-Actions:
runs-on: ubuntu-latest
steps:
- name: setup python
uses: actions/setup-python@v2
with:
python-version: 3.8 #install the python needed
- name: checkout
uses: actions/checkout@v3
with:
ref: ${{ github.ref }}
- name: install req
run: |
pip install -r ./requirements.txt
pip install fastapi uvicorn opencv-python-headless
sudo wget https://github.com/jgm/pandoc/releases/download/3.1.3/pandoc-3.1.3-1-amd64.deb
sudo dpkg -i pandoc-3.1.3-1-amd64.deb
- name: update
uses: actions/checkout@v3
with:
ref: ${{ github.ref }}
- name: run script
run: python ./scripts/generate_doc.py
- name: convert md to rst
run: |
cp docs/options.md docs/options_copy.md
file="docs/options_copy.md"
contents=$(cat "$file")
double_dash_contents=$(echo "$contents" | sed 's/\([^-\]\)--\([^-\]\)/\1\\--\2/g')
new_contents=$(echo "$double_dash_contents" | sed 's/\\|/,/g')
echo "$new_contents" > "$file"
pandoc --from markdown --to rst --standalone --wrap=none -s $file -o docs/source/options.rst
rm $file
- name: generate api doc
run: bash ./scripts/generate_api_doc.sh
- name: push
if: ${{ !env.ACT }}
run: |
git config user.name github-actions-jg
git config user.email [email protected]
git add .
git diff-index --quiet HEAD || (git commit -m "doc: options auto update" && git push)