Skip to content

Commit 5193e1c

Browse files
behacklnaveen521kk
andauthored
Introduce new workflow creating a downloadable version of the documentation (#3417)
* Revert "rtd: enable htmlzip build (#3355)" This reverts commit 571f79b. * use python3.11 to build docs * upgrade python version used in release publish workflow * new workflow for building downloadable docs * change event trigger for testing * sudo apt * rename release job; build html in poetry env * set GITHUB_PATH instead of PATH * introduce additional step * use correct binary path * forgot microtype * fonts-roboto + actually compress files correctly * fix asset path * Update .github/workflows/release-publish-documentation.yml Co-authored-by: Naveen M K <[email protected]> * pull_request -> workflow_dispatch * Update .github/workflows/release-publish-documentation.yml --------- Co-authored-by: Naveen M K <[email protected]>
1 parent 76b4061 commit 5193e1c

File tree

3 files changed

+86
-6
lines changed

3 files changed

+86
-6
lines changed

.github/workflows/python-publish.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ jobs:
1010
steps:
1111
- uses: actions/checkout@v4
1212

13-
- name: Set up Python 3.8
13+
- name: Set up Python 3.11
1414
uses: actions/setup-python@v4
1515
with:
16-
python-version: 3.9
16+
python-version: 3.11
1717

1818
- name: Install dependencies
1919
run: python -m pip install --upgrade poetry
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: Publish downloadable documentation
2+
3+
on:
4+
release:
5+
types: [released]
6+
workflow_dispatch:
7+
8+
jobs:
9+
build-and-publish-htmldocs:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
14+
- name: Set up Python 3.11
15+
uses: actions/setup-python@v4
16+
with:
17+
python-version: 3.11
18+
19+
- name: Install system dependencies
20+
run: |
21+
sudo apt update && sudo apt install -y \
22+
pkg-config libcairo-dev libpango1.0-dev ffmpeg wget fonts-roboto
23+
wget -qO- "https://yihui.org/tinytex/install-bin-unix.sh" | sh
24+
echo ${HOME}/.TinyTeX/bin/x86_64-linux >> $GITHUB_PATH
25+
26+
- name: Install LaTeX and Python dependencies
27+
run: |
28+
tlmgr install \
29+
babel-english ctex doublestroke dvisvgm frcursive fundus-calligra jknapltx \
30+
mathastext microtype physics preview ragged2e relsize rsfs setspace standalone \
31+
wasy wasysym
32+
python -m pip install --upgrade poetry
33+
poetry install
34+
35+
- name: Build and package documentation
36+
run: |
37+
cd docs/
38+
poetry run make html
39+
cd build/html/
40+
tar -czvf ../html-docs.tar.gz *
41+
42+
- name: Store artifacts
43+
uses: actions/upload-artifact@v3
44+
with:
45+
path: ${{ github.workspace }}/manim/docs/build/html-docs.tar.gz
46+
name: html-docs.tar.gz
47+
48+
- name: Install Dependency
49+
run: pip install requests
50+
51+
- name: Get Upload URL
52+
if: github.event == 'release'
53+
id: create_release
54+
shell: python
55+
env:
56+
access_token: ${{ secrets.GITHUB_TOKEN }}
57+
tag_act: ${{ github.ref }}
58+
run: |
59+
import requests
60+
import os
61+
ref_tag = os.getenv('tag_act').split('/')[-1]
62+
access_token = os.getenv('access_token')
63+
headers = {
64+
"Accept":"application/vnd.github.v3+json",
65+
"Authorization": f"token {access_token}"
66+
}
67+
url = f"https://api.github.com/repos/ManimCommunity/manim/releases/tags/{ref_tag}"
68+
c = requests.get(url,headers=headers)
69+
upload_url=c.json()['upload_url']
70+
with open(os.getenv('GITHUB_OUTPUT'), 'w') as f:
71+
print(f"upload_url={upload_url}", file=f)
72+
print(f"tag_name={ref_tag[1:]}", file=f)
73+
74+
- name: Upload Release Asset
75+
if: github.event == 'release'
76+
id: upload-release
77+
uses: actions/upload-release-asset@v1
78+
env:
79+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
80+
with:
81+
upload_url: ${{ steps.create_release.outputs.upload_url }}
82+
asset_path: ${{ github.workspace }}/manim/docs/build/html-docs.tar.gz
83+
asset_name: manim-htmldocs-${{ steps.create_release.outputs.tag_name }}.tar.gz
84+
asset_content_type: application/gzip

.readthedocs.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
version: 2
2-
3-
formats:
4-
- htmlzip
5-
62
build:
73
os: ubuntu-22.04
84

0 commit comments

Comments
 (0)