66 build-ctk-ver :
77 type : string
88 required : true
9+ component :
10+ description : " Component(s) to build docs for"
11+ required : false
12+ default : " all"
13+ type : string
14+ # below are the acceptable options:
15+ # - cuda-core
16+ # - cuda-bindings
17+ # - cuda-python
18+ # - all
19+ git-tag :
20+ description : " Target git tag to build docs for"
21+ required : false
22+ default : " "
23+ type : string
24+ is-release :
25+ description : " Are we building release docs?"
26+ required : false
27+ default : false
28+ type : boolean
929
1030jobs :
1131 build :
2747 uses : actions/checkout@v4
2848 with :
2949 fetch-depth : 0
50+ ref : ${{ inputs.git-tag }}
3051
3152 # TODO: cache conda env to speed up the workflow once conda-incubator/setup-miniconda#267
3253 # is resolved
@@ -114,23 +135,47 @@ jobs:
114135
115136 pip install cuda_python*.whl
116137
117- # This step sets the PR_NUMBER env var .
138+ # This step sets the PR_NUMBER/BUILD_LATEST/BUILD_PREVIEW env vars .
118139 - name : Get PR number
140+ if : ${{ !inputs.is-release }}
119141 uses : ./.github/actions/get_pr_number
120142
121- - name : Build all (latest) docs
122- id : build
143+ - name : Set up artifact directories
144+ run : |
145+ mkdir -p artifacts/docs
146+ # create an empty folder for removal use
147+ mkdir -p artifacts/empty_docs
148+
149+ - name : Build all docs
150+ if : ${{ inputs.component == 'all' }}
151+ env :
152+ DOC_ACTION : ${{ (inputs.is-release && '') || 'latest-only' }}
123153 run : |
124154 pushd cuda_python/docs/
125- ./build_all_docs.sh latest-only
155+ ./build_all_docs.sh $DOC_ACTION
156+ if [[ -z "$DOC_ACTION" ]]; then
157+ # At release time, we don't want to update the latest docs
158+ rm -rf build/html/latest
159+ fi
126160 ls -l build
127161 popd
128-
129- mkdir -p artifacts/docs
130162 mv cuda_python/docs/build/html/* artifacts/docs/
131163
132- # create an empty folder for removal use
133- mkdir -p artifacts/empty_docs
164+ - name : Build component docs
165+ if : ${{ inputs.component != 'all' }}
166+ env :
167+ DOC_ACTION : ${{ (inputs.is-release && '') || 'latest-only' }}
168+ run : |
169+ COMPONENT=$(echo "${{ inputs.component }}" | tr '-' '_')
170+ pushd ${COMPONENT}/docs/
171+ ./build_docs.sh $DOC_ACTION
172+ if [[ -z "$DOC_ACTION" ]]; then
173+ # At release time, we don't want to update the latest docs
174+ rm -rf build/html/latest
175+ fi
176+ ls -l build
177+ popd
178+ mv ${COMPONENT}/docs/build/html/* artifacts/docs/
134179
135180 # TODO: Consider removing this step?
136181 - name : Upload doc artifacts
@@ -140,19 +185,20 @@ jobs:
140185 retention-days : 3
141186
142187 - name : Deploy or clean up doc preview
188+ if : ${{ !inputs.is-release }}
143189 uses : ./.github/actions/doc_preview
144190 with :
145191 source-folder : ${{ (github.ref_name != 'main' && 'artifacts/docs') ||
146192 ' artifacts/empty_docs' }}
147193 pr-number : ${{ env.PR_NUMBER }}
148194
149195 - name : Deploy doc update
150- if : ${{ github.ref_name == 'main' }}
196+ if : ${{ github.ref_name == 'main' || inputs.is-release }}
151197 uses : JamesIves/github-pages-deploy-action@v4
152198 with :
153199 git-config-name : cuda-python-bot
154200 git-config-email : cuda-python-bot@users.noreply.github.com
155201 folder : artifacts/docs/
156202 target-folder : docs/
157- commit-message : " Deploy latest docs: ${{ github.sha }}"
203+ commit-message : " Deploy ${{ (inputs.is-release && 'release') || ' latest' }} docs: ${{ github.sha }}"
158204 clean : false
0 commit comments