Skip to content

Commit a0e3e5f

Browse files
committed
fix(ci): use gnu instead of musl for ripgrep Linux targets
Ripgrep 15.1.0 doesn't publish *-unknown-linux-musl binaries, only *-unknown-linux-gnu. This caused a 404 when bundling Linux releases. Also improves robustness: - Add curl retry logic (3 retries, 5s delay) - Graceful handling when checksum file is missing - Use find to locate extracted rg binary instead of hardcoded paths - Better error messages with archive contents on failure
1 parent 82fb184 commit a0e3e5f

1 file changed

Lines changed: 59 additions & 11 deletions

File tree

.github/workflows/release.yml

Lines changed: 59 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -264,14 +264,23 @@ jobs:
264264
verify_checksum() {
265265
local archive="$1"
266266
local checksum_file="$2"
267+
268+
if [ ! -f "$checksum_file" ]; then
269+
echo "⚠️ Checksum file missing for $(basename "$archive"), skipping verification"
270+
return 0
271+
fi
272+
267273
local expected
268274
local actual
269275
expected=$(awk '{print $1}' "$checksum_file")
270276
actual=$(sha256sum "$archive" | awk '{print $1}')
271277
if [ "$expected" != "$actual" ]; then
272-
echo "Checksum verification failed for $archive" >&2
278+
echo "❌ Checksum verification failed for $(basename "$archive")" >&2
279+
echo " Expected: $expected" >&2
280+
echo " Actual: $actual" >&2
273281
exit 1
274282
fi
283+
echo "✅ Checksum verified for $(basename "$archive")"
275284
}
276285
277286
bundle_unix() {
@@ -282,21 +291,40 @@ jobs:
282291
local rg_archive="ripgrep-${RIPGREP_VERSION}-${rg_target}.tar.gz"
283292
local rg_url="https://github.com/${RIPGREP_REPO}/releases/download/${RIPGREP_VERSION}/${rg_archive}"
284293
285-
curl -fsSL "$rg_url" -o "${temp_dir}/${rg_archive}"
286-
curl -fsSL "${rg_url}.sha256" -o "${temp_dir}/${rg_archive}.sha256"
294+
echo "📦 Downloading ripgrep: $rg_archive"
295+
if ! curl -fsSL --retry 3 --retry-delay 5 "$rg_url" -o "${temp_dir}/${rg_archive}"; then
296+
echo "❌ Failed to download ripgrep from: $rg_url" >&2
297+
rm -rf "$temp_dir"
298+
exit 1
299+
fi
300+
301+
echo "🔐 Downloading checksum file..."
302+
curl -fsSL "${rg_url}.sha256" -o "${temp_dir}/${rg_archive}.sha256" || true
287303
verify_checksum "${temp_dir}/${rg_archive}" "${temp_dir}/${rg_archive}.sha256"
288304
305+
echo "📂 Extracting ripgrep..."
289306
tar -xzf "${temp_dir}/${rg_archive}" -C "$temp_dir"
290307
308+
# Find the extracted rg binary (handles varying archive structures)
309+
local rg_bin
310+
rg_bin=$(find "$temp_dir" -name "rg" -type f | head -1)
311+
if [ -z "$rg_bin" ]; then
312+
echo "❌ Could not find rg binary in extracted archive" >&2
313+
echo "Archive contents:" >&2
314+
tar -tzf "${temp_dir}/${rg_archive}" >&2
315+
rm -rf "$temp_dir"
316+
exit 1
317+
fi
318+
291319
mkdir -p "${temp_dir}/bundle"
292320
cp "$binary" "${temp_dir}/bundle/autohand"
293-
cp "${temp_dir}/ripgrep-${RIPGREP_VERSION}-${rg_target}/rg" "${temp_dir}/bundle/rg"
321+
cp "$rg_bin" "${temp_dir}/bundle/rg"
294322
chmod +x "${temp_dir}/bundle/autohand" "${temp_dir}/bundle/rg"
295323
296324
tar -czf "${binary}.tar.gz" -C "${temp_dir}/bundle" autohand rg
297325
sha256sum "${binary}.tar.gz" > "${binary}.tar.gz.sha256"
298326
rm -rf "$temp_dir"
299-
echo "Created ${binary}.tar.gz"
327+
echo "Created ${binary}.tar.gz"
300328
}
301329
302330
bundle_windows() {
@@ -309,22 +337,42 @@ jobs:
309337
local rg_archive="ripgrep-${RIPGREP_VERSION}-${rg_target}.zip"
310338
local rg_url="https://github.com/${RIPGREP_REPO}/releases/download/${RIPGREP_VERSION}/${rg_archive}"
311339
312-
curl -fsSL "$rg_url" -o "${temp_dir}/${rg_archive}"
313-
curl -fsSL "${rg_url}.sha256" -o "${temp_dir}/${rg_archive}.sha256"
340+
echo "📦 Downloading ripgrep: $rg_archive"
341+
if ! curl -fsSL --retry 3 --retry-delay 5 "$rg_url" -o "${temp_dir}/${rg_archive}"; then
342+
echo "❌ Failed to download ripgrep from: $rg_url" >&2
343+
rm -rf "$temp_dir"
344+
exit 1
345+
fi
346+
347+
echo "🔐 Downloading checksum file..."
348+
curl -fsSL "${rg_url}.sha256" -o "${temp_dir}/${rg_archive}.sha256" || true
314349
verify_checksum "${temp_dir}/${rg_archive}" "${temp_dir}/${rg_archive}.sha256"
315350
351+
echo "📂 Extracting ripgrep..."
316352
unzip -q "${temp_dir}/${rg_archive}" -d "$temp_dir"
353+
354+
# Find the extracted rg.exe binary (handles varying archive structures)
355+
local rg_bin
356+
rg_bin=$(find "$temp_dir" -name "rg.exe" -type f | head -1)
357+
if [ -z "$rg_bin" ]; then
358+
echo "❌ Could not find rg.exe binary in extracted archive" >&2
359+
echo "Archive contents:" >&2
360+
unzip -l "${temp_dir}/${rg_archive}" >&2
361+
rm -rf "$temp_dir"
362+
exit 1
363+
fi
364+
317365
mkdir -p "${temp_dir}/bundle"
318366
cp "$binary" "${temp_dir}/bundle/autohand.exe"
319-
cp "${temp_dir}/ripgrep-${RIPGREP_VERSION}-${rg_target}/rg.exe" "${temp_dir}/bundle/rg.exe"
367+
cp "$rg_bin" "${temp_dir}/bundle/rg.exe"
320368
321369
(
322370
cd "${temp_dir}/bundle"
323371
zip -q "$output_path" autohand.exe rg.exe
324372
)
325373
sha256sum "${archive_name}" > "${archive_name}.sha256"
326374
rm -rf "$temp_dir"
327-
echo "Created ${archive_name}"
375+
echo "Created ${archive_name}"
328376
}
329377
330378
# Create tar.gz bundles for Unix platforms
@@ -338,11 +386,11 @@ jobs:
338386
fi
339387
if [ -f "autohand-linux-x64" ]; then
340388
chmod +x autohand-linux-x64
341-
bundle_unix "autohand-linux-x64" "x86_64-unknown-linux-musl"
389+
bundle_unix "autohand-linux-x64" "x86_64-unknown-linux-gnu"
342390
fi
343391
if [ -f "autohand-linux-arm64" ]; then
344392
chmod +x autohand-linux-arm64
345-
bundle_unix "autohand-linux-arm64" "aarch64-unknown-linux-musl"
393+
bundle_unix "autohand-linux-arm64" "aarch64-unknown-linux-gnu"
346394
fi
347395
348396
# Create bundled zip for Windows

0 commit comments

Comments
 (0)