|
| 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 |
0 commit comments