Skip to content

Commit c360f78

Browse files
committed
add upload var to control if docs are uploaded to s3/main
1 parent 7ae55b7 commit c360f78

File tree

4 files changed

+16
-4
lines changed

4 files changed

+16
-4
lines changed

.github/workflows/_build-tutorials-base.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@ on:
77
description: "Use nightly builds inside build.sh"
88
required: false
99
type: number
10-
default: false
10+
default: 0
11+
UPLOAD:
12+
description: "Upload built docs to PR preview and main site"
13+
required: false
14+
type: number
15+
default: 0
1116

1217
concurrency:
1318
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }}-${{ github.event_name == 'schedule' }}
@@ -77,6 +82,7 @@ jobs:
7782
JOB_TYPE: worker
7883
COMMIT_SOURCE: ${{ github.ref }}
7984
USE_NIGHTLY: ${{ inputs.USE_NIGHTLY }}
85+
UPLOAD: ${{ inputs.UPLOAD }}
8086
run: |
8187
set -ex
8288
@@ -90,6 +96,7 @@ jobs:
9096
-e JOB_TYPE \
9197
-e COMMIT_SOURCE \
9298
-e USE_NIGHTLY \
99+
-e UPLOAD \
93100
--env-file="/tmp/github_env_${GITHUB_RUN_ID}" \
94101
--tty \
95102
--detach \
@@ -110,6 +117,7 @@ jobs:
110117
name: pytorch_tutorial_build_manager
111118
needs: worker
112119
runs-on: [self-hosted, linux.2xlarge]
120+
if: ${{ inputs.UPLOAD == 1 }}
113121
environment: ${{ github.ref == 'refs/heads/main' && 'pytorchbot-env' || '' }}
114122
steps:
115123
- name: Setup SSH (Click me for login details)

.github/workflows/build-tutorials-nightly.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ jobs:
1616
secrets: inherit
1717
with:
1818
USE_NIGHTLY: 1
19+
UPLOAD: 0

.github/workflows/build-tutorials.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ jobs:
1616
secrets: inherit
1717
with:
1818
USE_NIGHTLY: 0
19+
UPLOAD: 1

.jenkins/build.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ sudo apt-get install -y pandoc
2020
# export PATH=/opt/conda/bin:$PATH
2121

2222
# Install PyTorch Nightly for test.
23-
if [ "$USE_NIGHTLY" -eq 1 ]; then
23+
if [ "${USE_NIGHTLY:-0}" -eq 1 ]; then
2424
sudo pip uninstall -y torch
2525
pip install --pre torch --index-url https://download.pytorch.org/whl/nightly/cu130
2626
pip show torch
@@ -120,8 +120,10 @@ if [[ "${JOB_TYPE}" == "worker" ]]; then
120120
python .jenkins/validate_tutorials_built.py
121121

122122
# Step 6: Copy generated files to S3, tag with commit ID
123-
7z a worker_${WORKER_ID}.7z docs
124-
awsv2 s3 cp worker_${WORKER_ID}.7z s3://${BUCKET_NAME}/${COMMIT_ID}/worker_${WORKER_ID}.7z
123+
if [ "${UPLOAD:-0}" -eq 1 ]; then
124+
7z a worker_${WORKER_ID}.7z docs
125+
awsv2 s3 cp worker_${WORKER_ID}.7z s3://${BUCKET_NAME}/${COMMIT_ID}/worker_${WORKER_ID}.7z
126+
fi
125127
elif [[ "${JOB_TYPE}" == "manager" ]]; then
126128
# Step 1: Generate no-plot HTML pages for all tutorials
127129
pip3 install -e git+https://github.com/pytorch/pytorch_sphinx_theme.git#egg=pytorch_sphinx_theme

0 commit comments

Comments
 (0)