From eb3a1b413018ca787909d714804cd812b3fbb9b3 Mon Sep 17 00:00:00 2001 From: wulan17 Date: Sat, 30 Dec 2023 21:15:39 +0700 Subject: [PATCH] Pyrofork: docs: Add versioning Signed-off-by: wulan17 --- .github/workflows/build-docs.yml | 5 +++-- build-docs.sh | 12 ++++++++++-- docs/source/conf.py | 7 ++++++- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml index ddf7288cd..b98b45151 100644 --- a/.github/workflows/build-docs.yml +++ b/.github/workflows/build-docs.yml @@ -2,8 +2,9 @@ name: Build-docs on: push: - tags: - - '*' + branches: + - main + - staging jobs: build: diff --git a/build-docs.sh b/build-docs.sh index 3981a026b..d9e1d024a 100644 --- a/build-docs.sh +++ b/build-docs.sh @@ -12,8 +12,16 @@ 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" = "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 + 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"