Skip to content

Commit bdb2854

Browse files
fix: switch from artifact upload to gh-pages branch deployment
The upload-pages-artifact@v4 action has a bug that truncates large files (all JS files were being truncated to ~1.4KB-12KB instead of their full size). Switched to the traditional peaceiris/actions-gh-pages@v3 action which: - Deploys directly to gh-pages branch (more reliable) - Handles large files correctly - Has proven track record with no truncation issues - Doesn't use the problematic artifact upload/extract process This should finally resolve the persistent file truncation issue.
1 parent 1dd7bce commit bdb2854

1 file changed

Lines changed: 18 additions & 83 deletions

File tree

.github/workflows/ci.yml

Lines changed: 18 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,7 @@ jobs:
7676
if: ${{ inputs.skip_build != true && (needs.validate.result == 'success' || inputs.deploy_only) }}
7777
timeout-minutes: 15
7878
permissions:
79-
contents: read
80-
pages: write
81-
id-token: write
82-
environment:
83-
name: github-pages
84-
url: ${{ steps.deployment.outputs.page_url }}
79+
contents: write
8580

8681
steps:
8782
- name: ⚡ Checkout
@@ -154,97 +149,37 @@ jobs:
154149
155150
echo "✅ Build artifacts verified - no modifications applied"
156151
157-
# ✅ Upload complete artifact without modifications
158-
- name: ⚡ Upload Pages artifact
159-
id: upload-artifact
160-
uses: actions/upload-pages-artifact@v4
161-
with:
162-
path: './dist'
163-
name: 'github-pages'
164-
retention-days: 1
165-
env:
166-
# Increase buffer sizes to prevent overflow
167-
NODE_OPTIONS: '--max-old-space-size=8192'
168-
# Set environment for stable tar operations
169-
TAR_OPTIONS: '--no-same-permissions --no-same-owner'
170-
continue-on-error: false
171-
172-
- name: ⚡ Fallback upload (DISABLED - was corrupting files)
173-
if: false
174-
run: |
175-
echo "⚠️ Fallback mechanism disabled to prevent file corruption"
176-
177-
# Remove any large image files that aren't critical
178-
find dist-fallback/ -name "*.jpg" -o -name "*.jpeg" -o -name "*.png" -o -name "*.gif" -o -name "*.webp" | while read file; do
179-
if [ $(stat -f%z "$file" 2>/dev/null || stat -c%s "$file" 2>/dev/null || echo 0) -gt 500000 ]; then
180-
echo "Removing large image: $file"
181-
rm "$file"
182-
fi
183-
done
184-
185-
# Keep only essential files for basic functionality
186-
echo "📦 Fallback artifact contents:"
187-
find dist-fallback/ -type f -name "*.html" -o -name "*.css" -o -name "*.js" | head -20
188-
189-
echo "📦 Fallback artifact size:"
190-
du -sh dist-fallback/
191-
192-
# Ensure we don't have any problematic file permissions
193-
chmod -R 755 dist-fallback/
194-
195-
# Final size check
196-
FALLBACK_SIZE=$(du -sb dist-fallback/ | cut -f1)
197-
FALLBACK_SIZE_MB=$((FALLBACK_SIZE / 1024 / 1024))
198-
echo "📊 Fallback artifact size: ${FALLBACK_SIZE_MB}MB"
199-
200-
if [ $FALLBACK_SIZE_MB -gt 100 ]; then
201-
echo "⚠️ Warning: Fallback artifact is still large (${FALLBACK_SIZE_MB}MB)"
202-
else
203-
echo "✅ Fallback artifact size is acceptable"
204-
fi
205-
206-
echo "✅ Fallback artifact prepared safely"
207-
208-
- name: ⚡ Upload fallback artifact (DISABLED)
209-
if: false
210-
uses: actions/upload-pages-artifact@v4
211-
with:
212-
path: './dist-fallback'
213-
name: 'github-pages'
214-
retention-days: 1
215-
env:
216-
# Use minimal buffer settings for fallback
217-
NODE_OPTIONS: '--max-old-space-size=2048'
218-
152+
# ✅ Deploy using gh-pages branch (more reliable for large files)
219153
- name: ⚡ Deploy to GitHub Pages
220-
id: deployment
221-
uses: actions/deploy-pages@v4
222-
timeout-minutes: 15
223-
env:
224-
# Increase timeout and buffer settings for large artifacts
225-
NODE_OPTIONS: '--max-old-space-size=4096'
226-
# Set longer timeout for CDN operations
227-
GITHUB_PAGES_TIMEOUT: '900'
154+
uses: peaceiris/actions-gh-pages@v3
155+
with:
156+
github_token: ${{ secrets.GITHUB_TOKEN }}
157+
publish_dir: ./dist
158+
publish_branch: gh-pages
159+
force_orphan: true
160+
user_name: 'github-actions[bot]'
161+
user_email: 'github-actions[bot]@users.noreply.github.com'
162+
commit_message: 'Deploy: ${{ github.event.head_commit.message }}'
228163

229164
- name: ⚡ Verify deployment
230165
run: |
231-
echo "🚀 Deployment completed!"
232-
echo "URL: ${{ steps.deployment.outputs.page_url }}"
233-
sleep 10
234-
if curl -fsSL --max-time 15 "${{ steps.deployment.outputs.page_url }}" > /dev/null; then
166+
echo "🚀 Deployment completed to gh-pages branch!"
167+
echo "URL: https://khalilcharfi.github.io"
168+
sleep 15
169+
if curl -fsSL --max-time 20 "https://khalilcharfi.github.io" > /dev/null; then
235170
echo "✅ Site is accessible"
236171
else
237-
echo "⚠️ Site may not be fully propagated yet"
172+
echo "⚠️ Site may not be fully propagated yet (CDN delay)"
238173
fi
239174
240175
- name: ⚡ Deployment summary
241176
run: |
242177
echo "## 🚀 Deployment Summary" >> $GITHUB_STEP_SUMMARY
243178
echo "### ✅ Status: Success" >> $GITHUB_STEP_SUMMARY
244-
echo "### 🔗 URL: ${{ steps.deployment.outputs.page_url }}" >> $GITHUB_STEP_SUMMARY
179+
echo "### 🔗 URL: https://khalilcharfi.github.io" >> $GITHUB_STEP_SUMMARY
245180
echo "### 📅 Deployed: $(date -u)" >> $GITHUB_STEP_SUMMARY
246181
echo "### 📦 Source: ${{ github.ref_name }} branch" >> $GITHUB_STEP_SUMMARY
247-
echo "### 🏗️ Build: $(du -sh dist | cut -f1)" >> $GITHUB_STEP_SUMMARY
182+
echo "### 🏗️ Deployed via: gh-pages branch" >> $GITHUB_STEP_SUMMARY
248183
249184
summary:
250185
name: 📊 Pipeline Summary

0 commit comments

Comments
 (0)