diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml new file mode 100644 index 000000000..b98b45151 --- /dev/null +++ b/.github/workflows/build-docs.yml @@ -0,0 +1,19 @@ +name: Build-docs + +on: + push: + branches: + - main + - staging + +jobs: + build: + + runs-on: ubuntu-22.04 + + steps: + - uses: actions/checkout@v3 + - name: Build + run: bash build-docs.sh + env: + DOCS_KEY: ${{ secrets.DOCS_KEY }} diff --git a/build-docs.sh b/build-docs.sh index 3981a026b..a3a628e3e 100644 --- a/build-docs.sh +++ b/build-docs.sh @@ -12,8 +12,17 @@ cd ../.. "$VENV"/bin/sphinx-build -b html "docs/source" "docs/build/html" -j auto git clone https://wulan17:"$DOCS_KEY"@github.com/Mayuri-Chan/pyrofork-docs.git cd pyrofork-docs -rm -rf _includes api genindex.html intro py-modindex.html sitemap.xml support.html topics _static faq index.html objects.inv searchindex.js start telegram -cp -r ../docs/build/html/* . +if [[ "$GITHUB_REF" == "refs/heads/main" ]]; then + rm -rf _includes api genindex.html intro py-modindex.html sitemap.xml support.html topics _static faq index.html objects.inv searchindex.js start telegram main + cp -r ../docs/build/html/* . + mkdir main + cp -r ../docs/build/html/* main/ +else + mkdir -p staging + cd staging + rm -rf _includes api genindex.html intro py-modindex.html sitemap.xml support.html topics _static faq index.html objects.inv searchindex.js start telegram + cp -r ../../docs/build/html/* . +fi git config --local user.name "Mayuri-Chan" git config --local user.email "mayuri@mayuri.my.id" git add --all diff --git a/docs/source/conf.py b/docs/source/conf.py index fc72b744d..a6163641d 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -94,7 +94,12 @@ "scheme": "slate" } ], - "toc_title_is_page_title": True + "toc_title_is_page_title": True, + "version_dropdown": True, + "version_info": [ + {"version": "main", "title": "main", "aliases": ["latest"]}, + {"version": "staging", "title": "staging", "aliases": []}, + ], } html_logo = "../resources/static/img/pyrogram.png"