This commit is contained in:
carlospolop
2025-10-04 01:46:26 +02:00
parent ab41eee8e8
commit 58f5fb17af
3 changed files with 22 additions and 29 deletions

View File

@@ -88,9 +88,8 @@ jobs:
RATIO=$(awk "BEGIN {printf \"%.1f\", ($COMPRESSED_SIZE / $ORIGINAL_SIZE) * 100}")
echo "Compression: ${ORIGINAL_SIZE} bytes -> ${COMPRESSED_SIZE} bytes (${RATIO}%)"
# Copy both versions to the searchindex repo
# Copy ONLY the .gz version to the searchindex repo (no uncompressed .js)
cd /tmp/searchindex-repo
cp "${GITHUB_WORKSPACE}/${ASSET}" "${FILENAME}"
cp "${GITHUB_WORKSPACE}/${ASSET}.gz" "${FILENAME}.gz"
# Stage all files

View File

@@ -175,10 +175,8 @@ jobs:
# Clone the searchindex repo
git clone https://x-access-token:${TOKEN}@github.com/${TARGET_REPO}.git /tmp/searchindex-repo
# Copy and compress the searchindex file
cp "$ASSET" "/tmp/searchindex-repo/${FILENAME}"
# Compress the searchindex file
gzip -9 -k -f "$ASSET"
cp "${ASSET}.gz" "/tmp/searchindex-repo/${FILENAME}.gz"
# Show compression stats
ORIGINAL_SIZE=$(wc -c < "$ASSET")
@@ -186,11 +184,14 @@ jobs:
RATIO=$(awk "BEGIN {printf \"%.1f\", ($COMPRESSED_SIZE / $ORIGINAL_SIZE) * 100}")
echo "Compression: ${ORIGINAL_SIZE} bytes -> ${COMPRESSED_SIZE} bytes (${RATIO}%)"
# Copy ONLY the .gz version to the searchindex repo (no uncompressed .js)
cp "${ASSET}.gz" "/tmp/searchindex-repo/${FILENAME}.gz"
# Commit and push with retry logic
cd /tmp/searchindex-repo
git config user.name "GitHub Actions"
git config user.email "github-actions@github.com"
git add "${FILENAME}" "${FILENAME}.gz"
git add "${FILENAME}.gz"
if git diff --staged --quiet; then
echo "No changes to commit"
@@ -223,12 +224,11 @@ jobs:
git config user.name "GitHub Actions"
git config user.email "github-actions@github.com"
# Re-copy and compress the searchindex file
cp "$ASSET" "${FILENAME}"
# Re-copy ONLY the .gz version (no uncompressed .js)
cp "${ASSET}.gz" "${FILENAME}.gz"
git add "${FILENAME}" "${FILENAME}.gz"
git commit -m "Update ${FILENAME} from hacktricks-cloud build"
git add "${FILENAME}.gz"
git commit -m "Update ${FILENAME}.gz from hacktricks-cloud build"
echo "Re-cloned and re-committed, will retry push..."
else
echo "Rebase failed for unknown reason, retrying anyway..."