Skip to content

Commit

Permalink
enable docs preview in prs (#66)
Browse files Browse the repository at this point in the history
PR enables docs uploads to S3 on pull requests (using the
`rapids-uploads-docs` script).
  • Loading branch information
AyodeAwe authored Jul 24, 2023
1 parent 71f9e9a commit 9bd2d93
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions tools/rapids-upload-docs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
# - RAPIDS_DOCS_DIR - a path to a directory containing the docs to upload
# - RAPIDS_VERSION_NUMBER - the version number of the docs being uploaded
set -euo pipefail
source rapids-constants

checks() {
if [[ ! -d "${RAPIDS_DOCS_DIR}" ]]; then
Expand All @@ -30,12 +31,6 @@ checks() {
echo "python -m http.server --directory ${RAPIDS_DOCS_DIR}"
exit 0
fi

# TODO: remove this block once pull-request previews are supported
if [[ "${RAPIDS_BUILD_TYPE}" == "pull-request" ]]; then
echo "Uploading docs for pull-requests is not yet supported."
exit 0
fi
}


Expand All @@ -44,7 +39,6 @@ get_s3_dest() {
local FORMAT=$2

case "${RAPIDS_BUILD_TYPE}" in
# TODO: double check this path once pull-request previews are supported
pull-request)
echo -n "$(rapids-s3-path)docs/${PROJECT}/${FORMAT}"
return
Expand Down Expand Up @@ -80,6 +74,18 @@ copy_docs_to_s3() {
"${PROJECT_FORMAT_DIR}" \
"$(get_s3_dest "${PROJECT}" "${FORMAT}")"
echo ""

if [[ "${RAPIDS_BUILD_TYPE}" != "pull-request" ]]; then
continue
fi

rapids-logger "${PROJECT} ${FORMAT} preview URL:"
HTTP_URL="$(
get_s3_dest "${PROJECT}" "${FORMAT}" |
sed "s|s3://${RAPIDS_DOWNLOADS_BUCKET}|https://${RAPIDS_DOWNLOADS_DOMAIN}|"
)"
echo "- ${HTTP_URL}/" | tee --append "${GITHUB_STEP_SUMMARY}"
echo ""
done
done
}
Expand Down

0 comments on commit 9bd2d93

Please sign in to comment.