Skip to content

Commit ed8ba94

Browse files
committed
Simplify documentation update workflow branch handling
- Modify pages branch deployment to use force push - Remove complex branch existence and update checks - Streamline Git worktree and branch management logic - Ensure consistent documentation deployment process
1 parent 9039db6 commit ed8ba94

File tree

1 file changed

+14
-25
lines changed

1 file changed

+14
-25
lines changed

.github/workflows/update_docs.yml

Lines changed: 14 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -55,23 +55,16 @@ jobs:
5555
run: |
5656
source venv/bin/activate
5757
sh build_html.sh
58-
5958
- name: Deploy to pages branch
6059
run: |
6160
# Create and switch to a new worktree for the pages branch
6261
git worktree add --detach pages
6362
cd pages
6463
65-
# Fetch and checkout pages branch, create if it doesn't exist
64+
# Delete pages branch if it exists and create a new orphan branch
6665
git fetch origin pages || true
67-
git checkout pages || git checkout --orphan pages
68-
69-
# If the branch exists, pull latest changes
70-
if git rev-parse --verify origin/pages >/dev/null 2>&1; then
71-
git pull origin pages
72-
fi
73-
74-
# Remove existing files to prepare for new content
66+
git branch -D pages || true
67+
git checkout --orphan pages
7568
git rm -rf . || true
7669
7770
# Copy built documentation
@@ -81,21 +74,17 @@ jobs:
8174
git config user.name "${GIT_USER_NAME}"
8275
git config user.email "${GIT_USER_EMAIL}"
8376
84-
# Check if there are changes to commit
85-
if [[ -n $(git status -s) ]]; then
86-
git add .
87-
git commit -m "docs: update documentation
88-
89-
Automated update by GitHub Actions
90-
Workflow: ${{ github.workflow }}
91-
Run ID: ${{ github.run_id }}
92-
Triggered by: ${{ github.event_name }}"
93-
94-
# Push changes to pages branch
95-
git push origin pages
96-
else
97-
echo "No changes to commit"
98-
fi
77+
# Add and commit all changes
78+
git add .
79+
git commit -m "docs: update documentation
80+
81+
Automated update by GitHub Actions
82+
Workflow: ${{ github.workflow }}
83+
Run ID: ${{ github.run_id }}
84+
Triggered by: ${{ github.event_name }}"
85+
86+
# Force push to pages branch
87+
git push -f origin pages
9988
10089
# Clean up the worktree
10190
cd ..

0 commit comments

Comments
 (0)