Skip to content

Commit

Permalink
test fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Unreal-Dan committed Aug 5, 2024
1 parent 955edf1 commit c43982b
Showing 1 changed file with 25 additions and 17 deletions.
42 changes: 25 additions & 17 deletions .github/workflows/deploy_docs.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
name: Build and Deploy Jekyll and Doxygen Documentation

on:
push:
branches:
- gh-pages
workflow_dispatch:
workflow_dispatch: # Allows manual trigger

# You can uncomment this section to trigger on specific branch pushes if needed
# push:
# branches:
# - master # Replace with your main branch
# - duo
# - handle
# - orbit
# - gloves
# - desktop
# - spark
# - chromadeck

permissions:
contents: write
pages: write
id-token: write

concurrency:
group: "pages"
cancel-in-progress: false

jobs:
build-and-deploy:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -44,19 +49,19 @@ jobs:
# Generate Doxygen Documentation
- name: Generate Doxygen Documentation
run: |
# Define the branches and their corresponding doc folders
branches=("master:core" "duo" "handle" "orbit" "gloves" "desktop" "spark" "chromadeck")
mkdir -p docs # Ensure the docs directory exists
# Iterate over each branch and generate documentation
for item in "${branches[@]}"; do
IFS=':' read -r branch dest <<< "$item"
dest="${dest:-$branch}"
# Check if the branch exists on the remote
if git ls-remote --heads origin $branch | grep -q $branch; then
echo "Checking out branch: $branch"
git checkout $branch
# Create a temporary directory for the branch
echo "Processing branch: $branch"
# Use a temporary directory for each branch to avoid conflicts
mkdir -p temp/$branch
git worktree add temp/$branch origin/$branch
Expand All @@ -66,32 +71,35 @@ jobs:
# Ensure the output directory exists in the docs folder
mkdir -p ../../docs/$dest
# Change OUTPUT_DIRECTORY in Doxyfile for each branch
# Adjust the Doxyfile to set the output directory
echo "Adjusting Doxyfile for branch: $branch"
sed -i "s|OUTPUT_DIRECTORY *=.*|OUTPUT_DIRECTORY = ../../docs/$dest|" Doxyfile
# Run Doxygen to generate the documentation
echo "Running Doxygen for branch: $branch"
doxygen Doxyfile || { echo "Doxygen failed for branch: $branch"; exit 1; }
echo "Generated docs for $branch in docs/$dest"
# Return to the root directory
cd ../..
# Remove the worktree after processing
# Clean up the worktree
git worktree remove temp/$branch -f
else
echo "Branch $branch does not exist on the remote."
fi
done
# Move Doxygen docs into the site directory
- name: Move Doxygen Docs to Site
run: mv docs _site/

# Deploy to GitHub Pages
- name: Deploy to GitHub Pages
id: deployment
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./_site
publish_branch: gh-pages
keep_files: true
force_orphan: false # Ensure we're working with existing branch structure

0 comments on commit c43982b

Please sign in to comment.