-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: refresh latest docs if we have sub versions
- Loading branch information
Showing
1 changed file
with
36 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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 |
---|---|---|
|
@@ -68,4 +68,39 @@ jobs: | |
git push origin main | ||
else | ||
echo "No changes to commit." | ||
fi | ||
fi | ||
- name: Rebuild Docs for Latest Version (main), if not already on main | ||
run: | | ||
# Only rebuild the main branch docs if the current ref is not "main" | ||
if [[ "$CURRENT_REF" != "main" ]]; then | ||
echo "Switching to main branch and rebuilding docs for 'latest'" | ||
# Checkout the main branch of the product repo to rebuild docs for "latest" | ||
git checkout main | ||
# Ensure the latest changes are pulled | ||
git pull origin main | ||
# Prepare Config for Main Branch Docs | ||
make config | ||
# Build Docs for Main Branch (latest) | ||
OUTPUT=$(pwd)/docs-output make build | ||
# Now handle the docs repository (docs-output), commit and push changes there | ||
cd docs-output # Switch to the docs-output directory (docs repo) | ||
git config user.name "GitHub Actions" | ||
git config user.email "[email protected]" | ||
if [[ -n $(git status --porcelain) ]]; then | ||
git add . | ||
git commit -m "Rebuild docs for main branch with latest version" | ||
git push origin main | ||
else | ||
echo "No changes to commit for docs." | ||
fi | ||
else | ||
echo "Current ref is 'main', skipping rebuild for 'latest'." | ||
fi | ||
working-directory: ./ # Working in the product repo, no commit here |