File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -105,11 +105,30 @@ jobs:
105105 echo ""
106106 echo "📦 Deployment structure:"
107107 find deploy -type f -name "*.html" | head -20
108+
109+ - name : Preserve gh-pages root index.html
110+ run : |
111+ # Fetch gh-pages to get existing index.html if we didn't create one
112+ if [ ! -f "deploy/index.html" ]; then
113+ echo "📄 No index.html in deploy, fetching from gh-pages..."
114+ git fetch origin gh-pages:gh-pages 2>/dev/null || true
115+
116+ # Check out just the index.html from gh-pages if it exists
117+ if git show origin/gh-pages:index.html > /dev/null 2>&1; then
118+ git show origin/gh-pages:index.html > deploy/index.html
119+ echo "✓ Preserved existing index.html from gh-pages"
120+ else
121+ echo "ℹ No index.html on gh-pages to preserve"
122+ fi
123+ else
124+ echo "ℹ index.html already in deploy directory, not fetching from gh-pages"
125+ fi
108126
109127 - name : Deploy to GitHub Pages
110128 uses : peaceiris/actions-gh-pages@v4
111129 with :
112130 github_token : ${{ secrets.GITHUB_TOKEN }}
113131 publish_dir : ./deploy
114- keep_files : true
132+ # Clean deployment each time to avoid stale files
133+ keep_files : false
115134 commit_message : ' Deploy documentation from ${{ github.sha }}'
You can’t perform that action at this time.
0 commit comments