-
Notifications
You must be signed in to change notification settings - Fork 607
Update doc-build.yml #3045
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
Closed
Update doc-build.yml #3045
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -74,17 +74,9 @@ jobs: | |
ls -R "${RUNNER_ARTIFACT_DIR}"/*/*.html | ||
# Enable preview later. Previews are available publicly | ||
# | ||
# upload-preview: | ||
# if: github.repository == 'pytorch/executorch' && github.event_name == 'push' && | ||
# (github.ref_type == 'branch' && github.ref_name == 'main') | ||
# uses: pytorch/test-infra/.github/workflows/linux_job.yml@main | ||
|
||
upload-gh-pages: | ||
needs: build | ||
if: github.repository == 'pytorch/executorch' && github.event_name == 'push' && | ||
((github.ref_type == 'branch' && github.ref_name == 'main') || github.ref_type == 'tag') | ||
if: github.repository == 'pytorch/executorch' && github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/') || startsWith(github.ref, 'refs/tags/v')) | ||
permissions: | ||
contents: write | ||
uses: pytorch/test-infra/.github/workflows/linux_job.yml@main | ||
|
@@ -99,6 +91,13 @@ jobs: | |
REF_TYPE=${{ github.ref_type }} | ||
REF_NAME=${{ github.ref_name }} | ||
# If it's main branch, add noindex tag to all .html files to exclude from Google Search indexing. | ||
REF_NAME=$(echo "${{ github.ref }}") | ||
echo "Ref name: ${REF_NAME}" | ||
if [[ "${{ github.ref }}" == 'refs/heads/main' ]]; then | ||
find docs -name "*.html" -print0 | xargs -0 sed -i '/<head>/a \ \ <meta name="robots" content="noindex">'; | ||
fi | ||
# If building for a release tag, branch, set the branch/tag name | ||
# as the target folder in the gh-pages branch. The artifacts created | ||
# during the build will be copied over to the target dir in the | ||
|
@@ -108,10 +107,16 @@ jobs: | |
elif [[ "${REF_TYPE}" == tag ]]; then | ||
# Strip the leading "v" as well as the trailing patch version and "-rc" suffix. | ||
# For example: 'v0.1.2' -> '0.1' and 'v0.1.2-rc1' -> 0.1. | ||
TARGET_FOLDER=$(echo "${REF_NAME}" | sed 's/^v//i; s/-rc[0-9]*$//; s/\.[0-9]*$//') | ||
else | ||
echo "ERROR: Invalid REF_TYPE: ${REF_TYPE}. Expected 'branch' or 'tag'." | ||
exit 1 | ||
case "${REF_NAME}" in | ||
*-rc*) | ||
echo "Aborting upload since this is an RC tag: ${REF_NAME}" | ||
# We don't generate -rc* documentation but for actual tag only. | ||
exit 0 | ||
;; | ||
*) | ||
TARGET_FOLDER=$(echo "${REF_NAME}" | sed 's/v\([0-9]\+\)\.\([0-9]\+\)\.[0-9]\+/\1.\2/') | ||
svekars marked this conversation as resolved.
Show resolved
Hide resolved
|
||
;; | ||
esac | ||
fi | ||
echo "Target Folder: ${TARGET_FOLDER}" | ||
|
@@ -122,12 +127,6 @@ jobs: | |
mv "${RUNNER_ARTIFACT_DIR}"/html/* "${TARGET_FOLDER}" | ||
git add "${TARGET_FOLDER}" || true | ||
# If it's main branch, add noindex tag to all .html files to exclude from Google Search indexing. | ||
if [[ "${REF_NAME}" == 'main' ]]; then | ||
find "${TARGET_FOLDER}" -type f -name "*.html" -exec sed -i '/<head>/a <meta name="robots" content="noindex">' {} \; | ||
git add "${TARGET_FOLDER}"/**/*.html || true | ||
fi | ||
git config user.name 'pytorchbot' | ||
git config user.email '[email protected]' | ||
git commit -m "Auto-generating sphinx docs" || true | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a comment explaining why it makes sense to abort when encountering an RC tag. Is it because we only want to generate docs for the actual release tag?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, I believe this is what we do across other repositories - no documentation will be generated for v1.0.0-rc1 or similar.