@@ -78,25 +78,32 @@ jobs:
7878 git config --global user.name "github-actions[bot]"
7979 git config --global user.email "github-actions[bot]@users.noreply.github.com"
8080
81+ # Store generated files in a safe location
82+ mkdir -p /tmp/gh-pages-content
83+ cp -r releases /tmp/gh-pages-content/ 2>/dev/null || mkdir -p /tmp/gh-pages-content/releases
84+ cp install.sh /tmp/gh-pages-content/ 2>/dev/null || true
85+ cp index.html /tmp/gh-pages-content/ 2>/dev/null || true
86+ cp manifest.json /tmp/gh-pages-content/ 2>/dev/null || true
87+
8188 # Check if gh-pages branch exists on remote
8289 if git ls-remote --heads origin gh-pages | grep gh-pages; then
8390 echo "gh-pages branch exists, checking it out..."
91+ # Remove untracked files that might conflict
92+ git clean -fd
8493 git fetch origin gh-pages
8594 git checkout gh-pages
95+ # Clean all existing content
96+ git rm -rf . 2>/dev/null || true
97+ rm -rf * .* 2>/dev/null || true
8698 else
8799 echo "gh-pages branch doesn't exist, creating orphan branch..."
88100 git checkout --orphan gh-pages
89101 git rm -rf . 2>/dev/null || true
102+ rm -rf * .* 2>/dev/null || true
90103 fi
91104
92- # Clean the working directory
93- rm -rf * .* 2>/dev/null || true
94-
95- # Copy generated site files
96- cp -r releases . || mkdir -p releases
97- cp install.sh . 2>/dev/null || true
98- cp index.html . 2>/dev/null || true
99- cp manifest.json . 2>/dev/null || true
105+ # Copy generated site files from safe location
106+ cp -r /tmp/gh-pages-content/* . 2>/dev/null || true
100107
101108 # Show what we're about to commit
102109 echo "Files to commit:"
0 commit comments