66 build-ctk-ver :
77 type : string
88 required : true
9+ component :
10+ description : " Component(s) to build docs for"
11+ required : true
12+ default : " all"
13+ type : choice
14+ 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 : true
22+ default : " "
23+ type : string
24+ is-release :
25+ description : " Are we building release docs?"
26+ required : true
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,40 @@ 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
126156 ls -l build
127157 popd
128-
129- mkdir -p artifacts/docs
130158 mv cuda_python/docs/build/html/* artifacts/docs/
131159
132- # create an empty folder for removal use
133- mkdir -p artifacts/empty_docs
160+ - name : Build component docs
161+ if : ${{ inputs.component != 'all' }}
162+ env :
163+ DOC_ACTION : ${{ (inputs.is-release && '') || 'latest-only' }}
164+ run : |
165+ COMPONENT=$(echo "${{ inputs.component }}" | tr '-' '_')
166+ pushd ${COMPONENT}/docs/
167+ ./build_docs.sh $DOC_ACTION
168+ ls -l build
169+ rm -rf build/html/latest
170+ popd
171+ mv ${COMPONENT}/docs/build/html/* artifacts/docs/
134172
135173 # TODO: Consider removing this step?
136174 - name : Upload doc artifacts
@@ -140,19 +178,20 @@ jobs:
140178 retention-days : 3
141179
142180 - name : Deploy or clean up doc preview
181+ if : ${{ inputs.is-release }}
143182 uses : ./.github/actions/doc_preview
144183 with :
145184 source-folder : ${{ (github.ref_name != 'main' && 'artifacts/docs') ||
146185 ' artifacts/empty_docs' }}
147186 pr-number : ${{ env.PR_NUMBER }}
148187
149188 - name : Deploy doc update
150- if : ${{ github.ref_name == 'main' }}
189+ if : ${{ github.ref_name == 'main' || inputs.is-release }}
151190 uses : JamesIves/github-pages-deploy-action@v4
152191 with :
153192 git-config-name : cuda-python-bot
154193 git-config-email :
[email protected] 155194 folder : artifacts/docs/
156195 target-folder : docs/
157- commit-message : " Deploy latest docs: ${{ github.sha }}"
196+ commit-message : " Deploy ${{ (inputs.is-release && 'release') || ' latest' }} docs: ${{ github.sha }}"
158197 clean : false
0 commit comments