1010jobs :
1111 build-docs :
1212 name : Build Documentation
13- runs-on : ubuntu-latest
13+ runs-on : linux.g5.4xlarge.nvidia.gpu
1414 timeout-minutes : 30
1515 steps :
1616 - name : Checkout
2424 miniconda-version : " latest"
2525 activate-environment : test
2626 python-version : ' 3.10'
27- auto-activate-base : false
27+ auto-activate : false
2828 - name : Verify conda environment
2929 shell : bash -l {0}
3030 run : |
3636 run : python -m pip install --upgrade pip
3737 - name : Install pytorch
3838 shell : bash -l {0}
39- run : python -m pip install torch==2.9.0.dev20250826 --extra- index-url https://download.pytorch.org/whl/nightly/cpu
39+ run : python -m pip install torch==2.9.0 --index-url https://download.pytorch.org/whl/test/cu130
4040 - name : Install monarch
4141 shell : bash -l {0}
4242 run : python -m pip install monarch-no-torch==0.1.0.dev20250826 --find-links assets/ci
@@ -51,61 +51,90 @@ jobs:
5151 - name : Build docs
5252 shell : bash -l {0}
5353 working-directory : docs
54- run : make html --keep-going SPHINXOPTS='-W'
54+ run : |
55+ set +e # Don't exit on error
56+ make html SPHINXOPTS="-WT --keep-going" || echo "Build completed with warnings/errors"
57+ set -e # Re-enable exit on error for subsequent commands
5558 - name : Upload docs artifact
5659 uses : actions/upload-artifact@v4
5760 with :
5861 name : docs
5962 path : docs/build/html/
6063
61- # doc-preview:
62- # runs-on: [ubuntu-latest]
63- # needs: build-docs
64- # if: ${{ github.event_name == 'pull_request' }}
65- # steps:
66- # - name: Checkout
67- # uses: actions/checkout@v4
68- # - name: Download artifact
69- # uses: actions/download-artifact@v4
70- # with:
71- # name: docs
72- # path: docs
73- # - name: Add noindex to preview docs
74- # run: |
75- # echo "Adding noindex meta tag to prevent search engine indexing of preview docs"
76- # find docs -name "*.html" -print0 | xargs -0 sed -i 's/<head>/<head>\n <meta name="robots" content="noindex">/'
77- # - name: Upload docs preview
78- # uses: seemethere/upload-artifact-s3@v5
79- # if: ${{ github.event_name == 'pull_request' }}
80- # with:
81- # retention-days: 14
82- # s3-bucket: doc-previews
83- # if-no-files-found: error
84- # path: docs
85- # s3-prefix: meta-pytorch/forge/${{ github.event.pull_request.number }}
64+ doc-preview :
65+ runs-on : linux.large
66+ needs : build-docs
67+ if : ${{ github.event_name == 'pull_request' }}
68+ steps :
69+ - name : Checkout
70+ uses : actions/checkout@v4
71+ - name : Download artifact
72+ uses : actions/download-artifact@v4
73+ with :
74+ name : docs
75+ path : docs
76+ - name : Add noindex to preview docs
77+ run : |
78+ echo "Adding noindex meta tag to prevent search engine indexing of preview docs"
79+ find docs -name "*.html" -print0 | xargs -0 sed -i 's/<head>/<head>\n <meta name="robots" content="noindex">/'
80+ - name : Upload docs preview
81+ uses : seemethere/upload-artifact-s3@v5
82+ if : ${{ github.event_name == 'pull_request' }}
83+ with :
84+ retention-days : 14
85+ s3-bucket : doc-previews
86+ if-no-files-found : error
87+ path : docs
88+ s3-prefix : meta-pytorch/forge/${{ github.event.pull_request.number }}
89+
90+ upload :
91+ runs-on : ubuntu-latest
92+ permissions :
93+ # Grant write permission here so that the doc can be pushed to gh-pages branch
94+ contents : write
95+ needs : build-docs
96+ if : github.repository == 'meta-pytorch/forge' && github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') || github.event_name == 'workflow_dispatch')
97+ steps :
98+ - name : Checkout
99+ uses : actions/checkout@v4
100+ with :
101+ ref : gh-pages
102+ persist-credentials : true
103+ - name : Download artifact
104+ uses : actions/download-artifact@v4
105+ with :
106+ name : docs
107+ path : docs
108+ # - name: Add no-index tag
109+ # run: |
110+ # REF_NAME=$(echo "${{ github.ref }}")
111+ # echo "Ref name: ${REF_NAME}"
112+ # if [[ "${{ github.ref }}" == 'refs/heads/main' ]]; then
113+ # find docs -name "*.html" -print0 | xargs -0 sed -i '/<head>/a \ \ <meta name="robots" content="noindex">';
114+ # fi
115+ - name : Move and commit changes
116+ run : |
117+ set -euo pipefail
118+ # Get github.ref for the output doc folder. By default "main"
119+ # If matches a tag like refs/tags/v1.12.0-rc3 or
120+ # refs/tags/v1.12.0 convert to 1.12
121+ GITHUB_REF=${{ github.ref }}
86122
87- deploy-docs :
88- needs : build-docs
89- if : github.ref == 'refs/heads/main'
90- permissions :
91- pages : write
92- id-token : write
93- environment :
94- name : github-pages
95- url : ${{ steps.deployment.outputs.page_url }}
96- runs-on : ubuntu-latest
97- steps :
98- - name : Download build artifact
99- uses : actions/download-artifact@v4
100- with :
101- name : docs
102- path : .
123+ # Convert refs/tags/v1.12.0rc3 into 1.12.
124+ # Adopted from https://github.com/pytorch/pytorch/blob/main/.github/workflows/_docs.yml#L150C11-L155C13
125+ if [[ "${GITHUB_REF}" =~ ^refs/tags/v([0-9]+\.[0-9]+)\.* ]]; then
126+ TARGET_FOLDER="${BASH_REMATCH[1]}"
127+ else
128+ TARGET_FOLDER="main"
129+ fi
130+ echo "Target Folder: ${TARGET_FOLDER}"
103131
104- - name : Upload Pages artifact
105- uses : actions/upload-pages-artifact@v3
106- with :
107- path : .
132+ mkdir -p "${TARGET_FOLDER}"
133+ rm -rf "${TARGET_FOLDER}"/*
134+ mv docs/* "${TARGET_FOLDER}"
108135
109- - name : Deploy to GitHub Pages
110- id : deployment
111- uses : actions/deploy-pages@v4
136+ git config user.name 'pytorchbot'
137+ git config user.email '[email protected] ' 138+ git add "${TARGET_FOLDER}" || true
139+ git commit -m "auto-generating sphinx docs" || true
140+ git push -f
0 commit comments