Skip to content

Commit e970a04

Browse files
Dale KunceDale Kunce
authored andcommitted
Fix deployment workflow: improve file copying and add debugging
- Replace find command with more reliable bash loop for file cleanup - Add comprehensive debugging output to track deployment process - Improve error handling and verification for _site content copying - Handle hidden files properly during deployment - Add verification steps to ensure CSS and assets are properly deployed This should resolve the main.css loading issue on missingmaps.org by ensuring files are properly extracted from _site to root of master branch.
1 parent 7d88e66 commit e970a04

File tree

1 file changed

+39
-5
lines changed

1 file changed

+39
-5
lines changed

.github/workflows/deploy.yml

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,18 +83,52 @@ jobs:
8383
git config --local user.email "[email protected]"
8484
git config --local user.name "GitHub Action"
8585
86-
# Remove all files except .git and _site
87-
find . -maxdepth 1 ! -name '.git' ! -name '.' ! -name '..' ! -name '_site' -exec rm -rf {} +
86+
# Debug: Show current directory contents
87+
echo "=== Before cleanup ==="
88+
ls -la
8889
89-
# Copy built site files to root
90-
cp -r _site/* .
91-
rm -rf _site
90+
# Remove all files except .git and _site (more targeted approach)
91+
shopt -s dotglob
92+
for item in *; do
93+
if [[ "$item" != ".git" && "$item" != "_site" ]]; then
94+
echo "Removing: $item"
95+
rm -rf "$item"
96+
fi
97+
done
98+
shopt -u dotglob
99+
100+
# Debug: Show directory after cleanup
101+
echo "=== After cleanup ==="
102+
ls -la
103+
104+
# Debug: Show _site contents
105+
echo "=== _site directory contents ==="
106+
ls -la _site/
107+
108+
# Copy built site files to root with verification
109+
if [ -d "_site" ] && [ "$(ls -A _site)" ]; then
110+
echo "Copying _site contents to root..."
111+
cp -rv _site/* .
112+
cp -rv _site/.[^.]* . 2>/dev/null || true # Copy hidden files if they exist
113+
echo "Copy completed. Removing _site directory..."
114+
rm -rf _site
115+
else
116+
echo "Error: _site directory is empty or does not exist"
117+
exit 1
118+
fi
119+
120+
# Debug: Show final directory structure
121+
echo "=== Final directory structure ==="
122+
ls -la
123+
echo "=== assets/styles directory ==="
124+
ls -la assets/styles/ || echo "No assets/styles directory found"
92125
93126
# Add and commit changes
94127
git add -A
95128
if git diff --staged --quiet; then
96129
echo "No changes to deploy"
97130
else
131+
echo "Committing and pushing changes..."
98132
git commit -m "CI deploy to gh-pages from publish@${{ github.sha }}"
99133
git push origin master
100134
fi

0 commit comments

Comments
 (0)