diff --git a/.github/workflows/_build-tutorials-base.yml b/.github/workflows/_build-tutorials-base.yml index e33c8c4bd6..e7a9fa0220 100644 --- a/.github/workflows/_build-tutorials-base.yml +++ b/.github/workflows/_build-tutorials-base.yml @@ -13,6 +13,11 @@ on: required: false type: number default: 0 + S3_PREFIX: + description: "S3 prefix path for uploading docs preview" + required: false + type: string + default: "pytorch/tutorials" jobs: worker: @@ -187,7 +192,7 @@ jobs: s3-bucket: doc-previews if-no-files-found: error path: docs - s3-prefix: pytorch/tutorials/${{ github.event.pull_request.number }} + s3-prefix: ${{ inputs.S3_PREFIX }}/${{ github.event.pull_request.number }} - name: Teardown Linux uses: pytorch/test-infra/.github/actions/teardown-linux@main diff --git a/.github/workflows/build-tutorials-nightly.yml b/.github/workflows/build-tutorials-nightly.yml index 8489b69185..0fb7bea430 100644 --- a/.github/workflows/build-tutorials-nightly.yml +++ b/.github/workflows/build-tutorials-nightly.yml @@ -32,4 +32,5 @@ jobs: secrets: inherit with: USE_NIGHTLY: 1 - UPLOAD: 0 + UPLOAD: 1 + S3_PREFIX: pytorch/tutorials-nightly-preview diff --git a/.jenkins/build.sh b/.jenkins/build.sh index 6ab16891f6..098173acc6 100755 --- a/.jenkins/build.sh +++ b/.jenkins/build.sh @@ -4,6 +4,14 @@ set -ex export BUCKET_NAME=pytorch-tutorial-build-pull-request +# Set build prefix based on whether this is a nightly build or not +# This prevents conflicts when both builds run simultaneously +if [ "${USE_NIGHTLY:-0}" -eq 1 ]; then + export BUILD_PREFIX="nightly" +else + export BUILD_PREFIX="stable" +fi + # set locale for click dependency in spacy export LC_ALL=C.UTF-8 export LANG=C.UTF-8 @@ -122,7 +130,7 @@ if [[ "${JOB_TYPE}" == "worker" ]]; then # Step 6: Copy generated files to S3, tag with commit ID if [ "${UPLOAD:-0}" -eq 1 ]; then 7z a worker_${WORKER_ID}.7z docs - awsv2 s3 cp worker_${WORKER_ID}.7z s3://${BUCKET_NAME}/${COMMIT_ID}/worker_${WORKER_ID}.7z + awsv2 s3 cp worker_${WORKER_ID}.7z s3://${BUCKET_NAME}/${BUILD_PREFIX}/${COMMIT_ID}/worker_${WORKER_ID}.7z fi elif [[ "${JOB_TYPE}" == "manager" ]]; then # Step 1: Generate no-plot HTML pages for all tutorials @@ -136,7 +144,7 @@ elif [[ "${JOB_TYPE}" == "manager" ]]; then # Step 3: Download generated with-plot HTML files and static files from S3, merge into one folder mkdir -p docs_with_plot/docs for ((worker_id=1;worker_id