Skip to content
Merged
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 56 additions & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ jobs:
uses: pytorch/test-infra/.github/workflows/linux_job.yml@main
with:
repository: pytorch/vision
upload-artifact: docs
script: |
set -euo pipefail

Expand Down Expand Up @@ -44,4 +45,58 @@ jobs:
sed -i -e 's/-j auto/-j 1/' Makefile
make html

mv build/html/* "${RUNNER_DOCS_DIR}"
cp -r build/html "${RUNNER_ARTIFACT_DIR}"

# On PRs we also want to upload the docs into our S3 bucket for preview.
if [[ ${{ github.event_name == 'pull_request' }} ]]; then
cp -r build/html/* "${RUNNER_DOCS_DIR}"
fi

upload:
# FIXME: this also needs to happen on created releases
# # FIXME: enable this before the PR is merged
# if: github.event_name == 'push' && github.event.push.base_ref == 'main'
needs: build
uses: pytorch/test-infra/.github/workflows/linux_job.yml@main
with:
repository: pytorch/vision
download-artifact: docs
ref: gh-pages
script: |
set -euo pipefail

TARGET="main"

mkdir -p "${TARGET}"
rm -rf "${TARGET}"/*
mv "${RUNNER_ARTIFACT_DIR}"/html/* "${TARGET}"
git add "${TARGET}" || true

if [[ "${TARGET}" == main ]]; then
mkdir -p _static
rm -rf _static/*
cp -r "${TARGET}"/_static/* _static
git add _static || true
fi

git config user.email "soumith+bot@pytorch.org"
git config user.name "pytorchbot"
git commit -m "auto-generating sphinx docs" || true

# FIXME: this needs to come from ${{ secrets }}
export GITHUB_PYTORCHBOT_TOKEN=FOO
{
echo "machine github.com"
echo "login pytorchbot"
echo "password ${GITHUB_PYTORCHBOT_TOKEN}"
} > ~/.netrc

# FIXME: remove this before the PR is merged. GHA automatically redacts secrets in the
# logs, so we are not leaking anything here. This just makes sure this workflow is
# able to push correctly after we merge the PR.
git status
cat ~/.netrc

git remote add origin https://github.com/pytorch/vision.git
# FIXME: enable this before the PR is merged
# git push -u origin gh-pages