Skip to content

Commit ea47be9

Browse files
committed
f
1 parent a9f99c6 commit ea47be9

File tree

1 file changed

+13
-23
lines changed

1 file changed

+13
-23
lines changed

.github/workflows/build_master.yml

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,22 @@ jobs:
6464
git config user.name "GitHub Actions"
6565
git config user.email "[email protected]"
6666
67+
# Save all current files from main branch to temp directory
68+
mkdir -p /tmp/searchindex-backup
69+
cp -r * /tmp/searchindex-backup/ 2>/dev/null || true
70+
6771
# Create a fresh orphan branch (no history)
6872
git checkout --orphan new-main
6973
70-
# Remove all existing files from git index
74+
# Remove all files from git index (but keep working directory)
7175
git rm -rf . 2>/dev/null || true
7276
73-
# Copy and compress the searchindex file
74-
cp "$ASSET" "${FILENAME}"
77+
# Restore all the files from backup (keeps all language files)
78+
cp -r /tmp/searchindex-backup/* . 2>/dev/null || true
79+
80+
# Now update/add our English searchindex file
7581
gzip -9 -k -f "$ASSET"
82+
cp "$ASSET" "${FILENAME}"
7683
cp "${ASSET}.gz" "${FILENAME}.gz"
7784
7885
# Show compression stats
@@ -81,34 +88,17 @@ jobs:
8188
RATIO=$(awk "BEGIN {printf \"%.1f\", ($COMPRESSED_SIZE / $ORIGINAL_SIZE) * 100}")
8289
echo "Compression: ${ORIGINAL_SIZE} bytes -> ${COMPRESSED_SIZE} bytes (${RATIO}%)"
8390
84-
# Add all files from other workflows (if they exist)
85-
git checkout main -- . 2>/dev/null || true
86-
87-
# Add our new files (will overwrite if they existed)
88-
cp "$ASSET" "${FILENAME}"
89-
cp "${ASSET}.gz" "${FILENAME}.gz"
90-
91-
# Create README if it doesn't exist
92-
if [ ! -f "README.md" ]; then
93-
echo "# HackTricks Search Index Repository" > README.md
94-
echo "" >> README.md
95-
echo "This repository contains searchindex files for HackTricks and HackTricks Cloud." >> README.md
96-
echo "Files are automatically generated and updated by GitHub Actions." >> README.md
97-
echo "" >> README.md
98-
echo "⚠️ This repository is reset periodically to keep history clean." >> README.md
99-
fi
100-
10191
# Stage all files
10292
git add -A
10393
10494
# Commit with timestamp
10595
TIMESTAMP=$(date -u +"%Y-%m-%d %H:%M:%S UTC")
106-
git commit -m "Update searchindex files - ${TIMESTAMP}"
96+
git commit -m "Update searchindex files - ${TIMESTAMP}" --allow-empty
10797
108-
# Force push to replace main branch (deletes history)
98+
# Force push to replace main branch (deletes history, keeps all files)
10999
git push -f origin new-main:main
110100
111-
echo "Successfully reset repository and pushed searchindex files"
101+
echo "Successfully reset repository history and pushed all searchindex files"
112102
113103
# Login in AWs
114104
- name: Configure AWS credentials using OIDC

0 commit comments

Comments
 (0)