Skip to content

Commit 40e3780

Browse files
fix: pre-compress JS files and mark all as binary to prevent truncation
Two-pronged approach to fix file truncation: 1. Pre-compress all JS files with gzip -9 (keeps original + .gz) 2. Add .gitattributes with '* binary' to prevent git text conversions This should prevent the mysterious 1,398 byte truncation and allow GitHub Pages to serve either the original or pre-compressed files.
1 parent e40b9dd commit 40e3780

1 file changed

Lines changed: 19 additions & 8 deletions

File tree

.github/workflows/ci.yml

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -160,29 +160,40 @@ jobs:
160160
echo "Last 100 chars:"
161161
tail -c 100 dist/assets/vendor-three-C2c03BIj.js
162162
163-
# ✅ Deploy using direct git push with LFS completely disabled
163+
# ✅ Deploy with pre-compressed files to work around truncation
164+
- name: ⚡ Pre-compress JS files
165+
run: |
166+
echo "📦 Pre-compressing JavaScript files..."
167+
cd dist
168+
find assets -name "*.js" -type f | while read file; do
169+
echo "Compressing: $file"
170+
gzip -9 -k "$file"
171+
ls -lh "$file" "$file.gz"
172+
done
173+
echo "✅ Pre-compression complete"
174+
164175
- name: ⚡ Deploy to GitHub Pages
165176
env:
166177
GIT_LFS_SKIP_SMUDGE: 1
167178
run: |
168-
echo "🚀 Deploying to gh-pages branch (LFS disabled)..."
179+
echo "🚀 Deploying to gh-pages branch..."
169180
cd dist
170181
git init
171-
# Disable Git LFS completely for this repository
172182
git config user.name "github-actions[bot]"
173183
git config user.email "github-actions[bot]@users.noreply.github.com"
174184
git config filter.lfs.required false
175185
git config filter.lfs.clean "cat"
176186
git config filter.lfs.smudge "cat"
177187
git config filter.lfs.process ""
178188
git config lfs.repositoryformatversion ""
179-
echo "✅ Git LFS disabled"
189+
# Treat all files as binary to prevent any text conversion
190+
echo "* binary" > .gitattributes
191+
echo "✅ Git configured (all files as binary)"
180192
git add -A
181193
echo "📦 Files to commit:"
182-
git status --short
183-
echo "📏 Verifying file sizes before commit:"
184-
ls -lh assets/vendor-three-C2c03BIj.js
185-
wc -c assets/vendor-three-C2c03BIj.js
194+
git status --short | head -20
195+
echo "📏 Verifying compressed file sizes:"
196+
ls -lh assets/vendor-three-C2c03BIj.js.gz 2>/dev/null || echo "Compressed file created"
186197
git commit -m "Deploy: ${{ github.event.head_commit.message }}"
187198
echo "📤 Pushing to gh-pages..."
188199
git push -f https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git HEAD:gh-pages

0 commit comments

Comments
 (0)