Skip to content

use _upload_docs job #8160

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Changes from all 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
37 changes: 3 additions & 34 deletions .github/workflows/doc-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,41 +82,10 @@ jobs:

upload-gh-pages:
needs: build
if: github.repository == 'pytorch/executorch' && github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))
permissions:
id-token: write
contents: write
uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main
uses: pytorch/test-infra/.github/workflows/_upload_docs.yml@main
with:
docs-branch: gh-pages
docs-name: docs
repository: pytorch/executorch
download-artifact: docs
ref: gh-pages
timeout: 90
script: |
set -euo pipefail

# Get github.ref for the output doc folder. By default "main"
# If matches a tag like refs/tags/v1.12.0-rc3 or
# refs/tags/v1.12.0 convert to 1.12
export GITHUB_REF=${{ github.ref }}

# Convert refs/tags/v1.12.0rc3 into 1.12.
# Adopted from https://github.com/pytorch/pytorch/blob/main/.github/workflows/_docs.yml#L150C11-L155C13
if [[ "${GITHUB_REF}" =~ ^refs/tags/v([0-9]+\.[0-9]+) ]]; then
TARGET_FOLDER="${BASH_REMATCH[1]}"
else
TARGET_FOLDER="main"
fi
echo "Target Folder: ${TARGET_FOLDER}"

mkdir -p "${TARGET_FOLDER}"
# Clean up target folder if exists and copy html output to the
# Target folder
rm -rf "${TARGET_FOLDER}"/*
mv "${RUNNER_ARTIFACT_DIR}"/html/* "${TARGET_FOLDER}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might want to double check that the files are what you expect them to be. The upload_docs workflow looks slightly different here

git add "${TARGET_FOLDER}" || true

git config user.name 'pytorchbot'
git config user.email '[email protected]'
git commit -m "Auto-generating sphinx docs" || true
git push -f
Loading