Skip to content

Fixed license of English version. #48

Fixed license of English version.

Fixed license of English version. #48

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 || true
echo -e '\n' >> python/requirements.txt
cat ocrweb/requirements.txt >> python/requirements.txt
git clone -b ${SUBMMIT_BRANCH} $CLONE_URL ${SUBMMIT_BRANCH}
cd ${SUBMMIT_BRANCH}
rm -r python || true
rm -r ocrweb || true
rm source/README.md || true
rm -r source/API || true
echo "======================"
echo ${SUBMMIT_BRANCH}
cp -r ../python .
cp -r ../ocrweb .
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/python python/ -f -E -M --implicit-namespaces -d 6
sphinx-apidoc -o source/API/ocrweb ocrweb/ -f -E -M --implicit-namespaces -d 6
echo -e "API\n======\n\n.. toctree::\n :maxdepth: 6\n\n python/modules\n ocrweb/modules\n" >> 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"