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+ run-id :
25+ description : " The GHA run ID that generated validated artifacts"
26+ required : false
27+ default : ${{ github.run_id }}
28+ type : string
29+ is-release :
30+ description : " Are we building release docs?"
31+ required : false
32+ default : false
33+ type : boolean
934
1035jobs :
1136 build :
2752 uses : actions/checkout@v4
2853 with :
2954 fetch-depth : 0
55+ ref : ${{ inputs.git-tag }}
3056
3157 # TODO: cache conda env to speed up the workflow once conda-incubator/setup-miniconda#267
3258 # is resolved
@@ -59,44 +85,77 @@ jobs:
5985 PYTHON_VERSION_FORMATTED="312" # see above
6086 REPO_DIR=$(pwd)
6187
88+ if [[ ${{ inputs.is-release }} == "true" ]]; then
89+ FILE_HASH="*"
90+ COMMIT_HASH="${{ inputs.git-tag }}"
91+ else
92+ FILE_HASH="${{ github.sha }}"
93+ COMMIT_HASH="${{ github.sha }}"
94+ fi
95+
6296 # make outputs from the previous job as env vars
6397 CUDA_CORE_ARTIFACT_BASENAME="cuda-core-python${PYTHON_VERSION_FORMATTED}-linux-64"
98+ echo "COMMIT_HASH=${COMMIT_HASH}" >> $GITHUB_ENV
6499 echo "CUDA_CORE_ARTIFACT_BASENAME=${CUDA_CORE_ARTIFACT_BASENAME}" >> $GITHUB_ENV
65- echo "CUDA_CORE_ARTIFACT_NAME=${CUDA_CORE_ARTIFACT_BASENAME}-${{ github.sha } }" >> $GITHUB_ENV
100+ echo "CUDA_CORE_ARTIFACT_NAME=${CUDA_CORE_ARTIFACT_BASENAME}-${FILE_HASH }" >> $GITHUB_ENV
66101 echo "CUDA_CORE_ARTIFACTS_DIR=$(realpath "$REPO_DIR/cuda_core/dist")" >> $GITHUB_ENV
67102 CUDA_BINDINGS_ARTIFACT_BASENAME="cuda-bindings-python${PYTHON_VERSION_FORMATTED}-cuda${{ inputs.build-ctk-ver }}-linux-64"
68103 echo "CUDA_BINDINGS_ARTIFACT_BASENAME=${CUDA_BINDINGS_ARTIFACT_BASENAME}" >> $GITHUB_ENV
69- echo "CUDA_BINDINGS_ARTIFACT_NAME=${CUDA_BINDINGS_ARTIFACT_BASENAME}-${{ github.sha } }" >> $GITHUB_ENV
104+ echo "CUDA_BINDINGS_ARTIFACT_NAME=${CUDA_BINDINGS_ARTIFACT_BASENAME}-${FILE_HASH }" >> $GITHUB_ENV
70105 echo "CUDA_BINDINGS_ARTIFACTS_DIR=$(realpath "$REPO_DIR/cuda_bindings/dist")" >> $GITHUB_ENV
71106
72107 - name : Download cuda-python build artifacts
73108 uses : actions/download-artifact@v4
74109 with :
75110 name : cuda-python-wheel
76111 path : .
112+ run-id : ${{ inputs.run-id }}
113+ github-token : ${{ github.token }}
77114
78115 - name : Display structure of downloaded cuda-python artifacts
79116 run : |
80117 pwd
81118 ls -lahR .
82119
83120 - name : Download cuda.bindings build artifacts
121+ if : ${{ !inputs.is-release }}
84122 uses : actions/download-artifact@v4
85123 with :
86124 name : ${{ env.CUDA_BINDINGS_ARTIFACT_NAME }}
87125 path : ${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }}
88126
127+ - name : Download cuda.bindings build artifacts
128+ if : ${{ inputs.is-release }}
129+ uses : actions/download-artifact@v4
130+ with :
131+ pattern : ${{ env.CUDA_BINDINGS_ARTIFACT_NAME }}
132+ merge-multiple : true
133+ path : ${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }}
134+ run-id : ${{ inputs.run-id }}
135+ github-token : ${{ github.token }}
136+
89137 - name : Display structure of downloaded cuda.bindings artifacts
90138 run : |
91139 pwd
92140 ls -lahR $CUDA_BINDINGS_ARTIFACTS_DIR
93141
94142 - name : Download cuda.core build artifacts
143+ if : ${{ !inputs.is-release }}
95144 uses : actions/download-artifact@v4
96145 with :
97146 name : ${{ env.CUDA_CORE_ARTIFACT_NAME }}
98147 path : ${{ env.CUDA_CORE_ARTIFACTS_DIR }}
99148
149+ - name : Download cuda.core build artifacts
150+ if : ${{ inputs.is-release }}
151+ uses : actions/download-artifact@v4
152+ with :
153+ pattern : ${{ env.CUDA_CORE_ARTIFACT_NAME }}
154+ merge-multiple : true
155+ path : ${{ env.CUDA_CORE_ARTIFACTS_DIR }}
156+ run-id : ${{ inputs.run-id }}
157+ github-token : ${{ github.token }}
158+
100159 - name : Display structure of downloaded cuda.core build artifacts
101160 run : |
102161 pwd
@@ -114,23 +173,53 @@ jobs:
114173
115174 pip install cuda_python*.whl
116175
117- # This step sets the PR_NUMBER env var .
176+ # This step sets the PR_NUMBER/BUILD_LATEST/BUILD_PREVIEW env vars .
118177 - name : Get PR number
178+ if : ${{ !inputs.is-release }}
119179 uses : ./.github/actions/get_pr_number
120180
121- - name : Build all (latest) docs
122- id : build
181+ - name : Set up artifact directories
182+ run : |
183+ mkdir -p artifacts/docs
184+ # create an empty folder for removal use
185+ mkdir -p artifacts/empty_docs
186+
187+ - name : Build all docs
188+ if : ${{ inputs.component == 'all' }}
123189 run : |
124190 pushd cuda_python/docs/
125- ./build_all_docs.sh latest-only
191+ if [[ "${{ inputs.is-release }}" == "false" ]]; then
192+ ./build_all_docs.sh latest-only
193+ else
194+ ./build_all_docs.sh
195+ # At release time, we don't want to update the latest docs
196+ rm -rf build/html/latest
197+ fi
126198 ls -l build
127199 popd
128-
129- mkdir -p artifacts/docs
130200 mv cuda_python/docs/build/html/* artifacts/docs/
131201
132- # create an empty folder for removal use
133- mkdir -p artifacts/empty_docs
202+ - name : Build component docs
203+ if : ${{ inputs.component != 'all' }}
204+ run : |
205+ COMPONENT=$(echo "${{ inputs.component }}" | tr '-' '_')
206+ pushd ${COMPONENT}/docs/
207+ if [[ "${{ inputs.is-release }}" == "false" ]]; then
208+ ./build_docs.sh latest-only
209+ else
210+ ./build_docs.sh
211+ # At release time, we don't want to update the latest docs
212+ rm -rf build/html/latest
213+ fi
214+ ls -l build
215+ popd
216+ if [[ "${{ inputs.component }}" != "cuda-python" ]]; then
217+ TARGET="${{ inputs.component }}"
218+ mkdir -p artifacts/docs/${TARGET}
219+ else
220+ TARGET=""
221+ fi
222+ mv ${COMPONENT}/docs/build/html/* artifacts/docs/${TARGET}
134223
135224 # TODO: Consider removing this step?
136225 - name : Upload doc artifacts
@@ -140,19 +229,20 @@ jobs:
140229 retention-days : 3
141230
142231 - name : Deploy or clean up doc preview
232+ if : ${{ !inputs.is-release }}
143233 uses : ./.github/actions/doc_preview
144234 with :
145235 source-folder : ${{ (github.ref_name != 'main' && 'artifacts/docs') ||
146236 ' artifacts/empty_docs' }}
147237 pr-number : ${{ env.PR_NUMBER }}
148238
149239 - name : Deploy doc update
150- if : ${{ github.ref_name == 'main' }}
240+ if : ${{ github.ref_name == 'main' || inputs.is-release }}
151241 uses : JamesIves/github-pages-deploy-action@v4
152242 with :
153243 git-config-name : cuda-python-bot
154244 git-config-email : cuda-python-bot@users.noreply.github.com
155245 folder : artifacts/docs/
156246 target-folder : docs/
157- commit-message : " Deploy latest docs: ${{ github.sha }}"
247+ commit-message : " Deploy ${{ (inputs.is-release && 'release') || ' latest' }} docs: ${{ env.COMMIT_HASH }}"
158248 clean : false
0 commit comments