Skip to content

πŸ“„ Awesome OCR multiple programing languages toolkits based on ONNX Runtime, OpenVINO, MNN, PaddlePaddle, TensorRT and PyTorch.

Add rtd docs

SWHL5f347d287dc5
diff --git a/.github/workflows/deploy_docs_to_rtd.yml b/.github/workflows/deploy_docs_to_rtd.yml
new file mode 100644
index 0000000..031da9c
--- /dev/null
+++ b/.github/workflows/deploy_docs_to_rtd.yml
@@ -0,0 +1,76 @@
+name: Deploy the docs to RTD
+
+env:
+ REPO_SSH: ${{ github.event.repository.ssh_url }}
+ CLONE_URL: ${{ github.event.repository.clone_url }}
+ USER_NAME: SWHL
+ USER_EMAIL: [email protected]
+ SUBMMIT_BRANCH: docs
+
+on:
+ push:
+ branches: [ main ]
+ paths:
+ - 'python/**'
+ - '.github/workflows/deploy_docs_to_rtd.yml'
+ - 'README.md'
+
+jobs:
+ Deploy_TO_RTD:
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v3
+
+ - name: Set up Python 3.7
+ uses: actions/setup-python@v4
+ with:
+ python-version: '3.7'
+ architecture: 'x64'
+
+ - name: Set SSH Environment
+ env:
+ DEPLOY_KEYS: ${{ secrets.DEPLOY_KEYS }}
+ run: |
+ mkdir -p ~/.ssh/
+ echo "$DEPLOY_KEYS" > ~/.ssh/id_rsa
+ chmod 600 ~/.ssh/id_rsa
+ chmod 700 ~/.ssh && chmod 600 ~/.ssh/*
+ git config --global user.name $USER_NAME
+ git config --global user.email $USER_EMAIL
+
+ - name: Summit repo to docs branch.
+ run: |
+ ls
+ rm -r docs
+
+ git clone -b ${SUBMMIT_BRANCH} $CLONE_URL ${SUBMMIT_BRANCH}
+ cd ${SUBMMIT_BRANCH}
+ rm -r python || true
+ rm source/README.md || true
+
+ echo "====================="
+ echo ${SUBMMIT_BRANCH}
+ cp -r ../python .
+
+ echo "Update requirements and add packages needed by sphinx"
+ echo -e '\nsphinx_rtd_theme\nsphinxcontrib.mermaid\nmyst-parser\nsphinx_copybutton\nget_pypi_latest_version' >> ../python/requirements.txt
+ rm requirements.txt
+ cp ../python/requirements.txt .
+
+ echo "replace mermaid to {mermaid}"
+ sed -i 's/mermaid/{mermaid}/g' ../README.md
+
+ cp ../README.md source/
+
+ echo "Generate the api doc"
+ pip install sphinx
+ sphinx-apidoc -o source/API/ ./${PACKAGE_NAME} -f -E -M
+ sed -i '1d' source/API/modules.rst
+ sed -i '1i\API' source/API/modules.rst
+
+ git add .
+ git status
+ git remote remove origin
+ git remote add origin ${REPO_SSH}
+ git commit -m 'Actions auto update' && git push -f origin ${SUBMMIT_BRANCH} || echo "No changes to commit"