Skip to content

Commit

Permalink
build: refresh latest docs if we have sub versions
Browse files Browse the repository at this point in the history
  • Loading branch information
medcl committed Nov 13, 2024
1 parent 3a2d834 commit cfe8b1b
Showing 1 changed file with 36 additions and 1 deletion.
37 changes: 36 additions & 1 deletion .github/workflows/build-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit cfe8b1b

Please sign in to comment.