Skip to content

Commit caddb40

Browse files
committed
Use find instead of shallow globs when staging release artifacts
upload-artifact@v4 strips the longest common path prefix from matched files. For uploads spanning two sibling directories (Windows exe/msi, macOS dmg/pkg, Linux deb/rpm) the per-extension subdirectory survives inside the artifact, so files land under artifacts/windows-installers/ exe/<file>.exe rather than artifacts/windows-installers/<file>.exe. The previous shallow glob missed those nested files entirely and the completeness guard fired on every run despite all builds succeeding. Switching to find makes staging robust regardless of the artifact's internal layout. Also prints the downloaded artifact tree once at the top of the step so future layout drift is diagnosable from the run log.
1 parent d13393c commit caddb40

1 file changed

Lines changed: 32 additions & 21 deletions

File tree

.github/workflows/build-desktop-platforms.yml

Lines changed: 32 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,16 @@ jobs:
450450
set -euo pipefail
451451
mkdir -p release-files
452452
453+
# Snapshot of what download-artifact@v4 actually produced —
454+
# useful when build-output paths drift in the future.
455+
# upload-artifact@v4 strips the longest common prefix, so paths
456+
# like main/exe/*.exe + main/msi/*.msi land as exe/*.exe and
457+
# msi/*.msi inside the artifact. Fixed shallow globs miss them;
458+
# we use `find` below for resilience.
459+
echo "=== Downloaded artifact tree ==="
460+
find artifacts -maxdepth 4 -type f 2>/dev/null | sort
461+
echo
462+
453463
# stage() returns 0 on a successful copy, 1 if the source is missing.
454464
# Callers use the exit status to increment per-group counters so the
455465
# completeness guard at the end can detect missing groups.
@@ -473,53 +483,54 @@ jobs:
473483
linux_arch_count=0
474484
475485
# Windows — names already unique (.exe, .msi)
476-
for f in artifacts/windows-installers/*.exe artifacts/windows-installers/*.msi; do
477-
[ -f "$f" ] || continue
486+
while IFS= read -r f; do
487+
[ -n "$f" ] || continue
478488
stage "$f" "$(basename "$f")" && windows_count=$((windows_count + 1)) || true
479-
done
489+
done < <(find artifacts/windows-installers -type f \( -name '*.exe' -o -name '*.msi' \) 2>/dev/null)
480490
481491
# macOS — disambiguate x64 vs arm64 (Compose outputs identical filenames per arch)
482-
for f in artifacts/macos-installers-x64/*.dmg artifacts/macos-installers-x64/*.pkg; do
483-
[ -f "$f" ] || continue
492+
while IFS= read -r f; do
493+
[ -n "$f" ] || continue
484494
base="$(basename "$f")"
485495
ext="${base##*.}"
486496
stem="${base%.*}"
487497
stage "$f" "${stem}-x64.${ext}" && macos_x64_count=$((macos_x64_count + 1)) || true
488-
done
489-
for f in artifacts/macos-installers-arm64/*.dmg artifacts/macos-installers-arm64/*.pkg; do
490-
[ -f "$f" ] || continue
498+
done < <(find artifacts/macos-installers-x64 -type f \( -name '*.dmg' -o -name '*.pkg' \) 2>/dev/null)
499+
500+
while IFS= read -r f; do
501+
[ -n "$f" ] || continue
491502
base="$(basename "$f")"
492503
ext="${base##*.}"
493504
stem="${base%.*}"
494505
stage "$f" "${stem}-arm64.${ext}" && macos_arm64_count=$((macos_arm64_count + 1)) || true
495-
done
506+
done < <(find artifacts/macos-installers-arm64 -type f \( -name '*.dmg' -o -name '*.pkg' \) 2>/dev/null)
496507
497508
# Linux modern — default Debian/RPM (unprefixed)
498-
for f in artifacts/linux-installers-modern/*.deb artifacts/linux-installers-modern/*.rpm; do
499-
[ -f "$f" ] || continue
509+
while IFS= read -r f; do
510+
[ -n "$f" ] || continue
500511
stage "$f" "$(basename "$f")" && linux_modern_count=$((linux_modern_count + 1)) || true
501-
done
512+
done < <(find artifacts/linux-installers-modern -type f \( -name '*.deb' -o -name '*.rpm' \) 2>/dev/null)
502513
503514
# Linux debian12-compat — suffix to avoid collision with modern
504-
for f in artifacts/linux-installers-debian12-compat/*.deb artifacts/linux-installers-debian12-compat/*.rpm; do
505-
[ -f "$f" ] || continue
515+
while IFS= read -r f; do
516+
[ -n "$f" ] || continue
506517
base="$(basename "$f")"
507518
ext="${base##*.}"
508519
stem="${base%.*}"
509520
stage "$f" "${stem}-debian12.${ext}" && linux_debian12_count=$((linux_debian12_count + 1)) || true
510-
done
521+
done < <(find artifacts/linux-installers-debian12-compat -type f \( -name '*.deb' -o -name '*.rpm' \) 2>/dev/null)
511522
512523
# Linux AppImage + zsync (filenames already include -x86_64)
513-
for f in artifacts/linux-appimage/*.AppImage artifacts/linux-appimage/*.AppImage.zsync; do
514-
[ -f "$f" ] || continue
524+
while IFS= read -r f; do
525+
[ -n "$f" ] || continue
515526
stage "$f" "$(basename "$f")" && linux_appimage_count=$((linux_appimage_count + 1)) || true
516-
done
527+
done < <(find artifacts/linux-appimage -type f \( -name '*.AppImage' -o -name '*.AppImage.zsync' \) 2>/dev/null)
517528
518529
# Linux Arch (.pkg.tar.zst already has version + arch in filename)
519-
for f in artifacts/linux-arch/*.pkg.tar.zst; do
520-
[ -f "$f" ] || continue
530+
while IFS= read -r f; do
531+
[ -n "$f" ] || continue
521532
stage "$f" "$(basename "$f")" && linux_arch_count=$((linux_arch_count + 1)) || true
522-
done
533+
done < <(find artifacts/linux-arch -type f -name '*.pkg.tar.zst' 2>/dev/null)
523534
524535
echo
525536
echo "Final staged files:"

0 commit comments

Comments
 (0)