Skip to content

Commit 8de7039

Browse files
committed
fix: prevent empty deployments and handle workflow changes
- Add .github/workflows/ changes to trigger full rebuild - Add safety check to prevent deploying empty directories - Skip deployment if no content available to prevent wiping existing sites This fixes the issue where workflow changes caused empty deployments.
1 parent e7770a3 commit 8de7039

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

.github/workflows/deploy-dev.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
fi
5454
5555
# Check if packages changed (theme/preset) - triggers rebuild of everything
56-
if git diff --name-only HEAD^ HEAD | grep -qE '^(packages/|pnpm-lock.yaml|package.json)'; then
56+
if git diff --name-only HEAD^ HEAD | grep -qE '^(packages/|pnpm-lock.yaml|package.json|\.github/workflows/)'; then
5757
echo "packages=true" >> $GITHUB_OUTPUT
5858
else
5959
echo "packages=false" >> $GITHUB_OUTPUT
@@ -270,7 +270,18 @@ jobs:
270270
path: deployment/unimarc
271271
continue-on-error: true
272272

273+
- name: Check if deployment has content
274+
id: check-content
275+
run: |
276+
if [ -d "deployment" ] && [ "$(ls -A deployment 2>/dev/null)" ]; then
277+
echo "has-content=true" >> $GITHUB_OUTPUT
278+
else
279+
echo "has-content=false" >> $GITHUB_OUTPUT
280+
echo "WARNING: No content to deploy - skipping deployment to prevent wiping existing site"
281+
fi
282+
273283
- name: Create standards index
284+
if: steps.check-content.outputs.has-content == 'true'
274285
run: |
275286
cat > deployment/standards.html << 'INDEXEOF'
276287
<!DOCTYPE html>
@@ -391,13 +402,16 @@ jobs:
391402
INDEXEOF
392403
393404
- name: Setup Pages
405+
if: steps.check-content.outputs.has-content == 'true'
394406
uses: actions/configure-pages@v5
395407

396408
- name: Upload artifact
409+
if: steps.check-content.outputs.has-content == 'true'
397410
uses: actions/upload-pages-artifact@v3
398411
with:
399412
path: deployment
400413

401414
- name: Deploy to GitHub Pages
415+
if: steps.check-content.outputs.has-content == 'true'
402416
id: deployment
403417
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)