fix: update build script to sort files by modification time for better accuracy

This commit is contained in:
2026-02-20 15:29:02 +11:00
parent 809e06f9c9
commit ba636fe6fc

View File

@@ -116,22 +116,22 @@ jobs:
if (Test-Path $outDir) { Remove-Item -Recurse -Force $outDir } if (Test-Path $outDir) { Remove-Item -Recurse -Force $outDir }
New-Item -ItemType Directory -Force -Path $outDir | Out-Null New-Item -ItemType Directory -Force -Path $outDir | Out-Null
# Find and copy MSI from cache location # Find and copy MSI from cache location (get NEWEST file by LastWriteTime)
$srcDir = "$env:CARGO_TARGET_DIR/release/bundle/msi" $srcDir = "$env:CARGO_TARGET_DIR/release/bundle/msi"
Write-Host "Looking for MSI in: $srcDir" Write-Host "Looking for MSI in: $srcDir"
Get-ChildItem $srcDir -ErrorAction SilentlyContinue Get-ChildItem $srcDir -ErrorAction SilentlyContinue | Sort-Object LastWriteTime -Descending
$msi = Get-ChildItem "$srcDir/*.msi" -Exclude "Cinny-*" -ErrorAction Stop | Select-Object -First 1 $msi = Get-ChildItem "$srcDir/*.msi" -ErrorAction Stop | Sort-Object LastWriteTime -Descending | Select-Object -First 1
Write-Host "Found MSI: $($msi.FullName) (Size: $($msi.Length) bytes)" Write-Host "Found MSI: $($msi.FullName) (Size: $($msi.Length) bytes, Modified: $($msi.LastWriteTime))"
Copy-Item $msi.FullName "$outDir/Cinny-Windows-x64.msi" -Force Copy-Item $msi.FullName "$outDir/Cinny-Windows-x64.msi" -Force
$msiZip = Get-ChildItem "$srcDir/*.msi.zip" -Exclude "Cinny-*" -ErrorAction SilentlyContinue | Select-Object -First 1 $msiZip = Get-ChildItem "$srcDir/*.msi.zip" -ErrorAction SilentlyContinue | Sort-Object LastWriteTime -Descending | Select-Object -First 1
if ($msiZip) { if ($msiZip) {
Write-Host "Found MSI.zip: $($msiZip.FullName)" Write-Host "Found MSI.zip: $($msiZip.FullName)"
Copy-Item $msiZip.FullName "$outDir/Cinny-Windows-x64.msi.zip" -Force Copy-Item $msiZip.FullName "$outDir/Cinny-Windows-x64.msi.zip" -Force
} }
$msiZipSig = Get-ChildItem "$srcDir/*.msi.zip.sig" -Exclude "Cinny-*" -ErrorAction SilentlyContinue | Select-Object -First 1 $msiZipSig = Get-ChildItem "$srcDir/*.msi.zip.sig" -ErrorAction SilentlyContinue | Sort-Object LastWriteTime -Descending | Select-Object -First 1
if ($msiZipSig) { if ($msiZipSig) {
Write-Host "Found MSI.zip.sig: $($msiZipSig.FullName)" Write-Host "Found MSI.zip.sig: $($msiZipSig.FullName)"
Copy-Item $msiZipSig.FullName "$outDir/Cinny-Windows-x64.msi.zip.sig" -Force Copy-Item $msiZipSig.FullName "$outDir/Cinny-Windows-x64.msi.zip.sig" -Force
@@ -215,30 +215,30 @@ jobs:
mkdir -p src-tauri/target/release/bundle/deb mkdir -p src-tauri/target/release/bundle/deb
mkdir -p src-tauri/target/release/bundle/rpm mkdir -p src-tauri/target/release/bundle/rpm
# Show what's available in cache # Show what's available in cache (sorted by time, newest first)
echo "Available AppImage files:" echo "Available AppImage files:"
ls -la $CARGO_TARGET_DIR/release/bundle/appimage/ || true ls -lt $CARGO_TARGET_DIR/release/bundle/appimage/ 2>/dev/null || true
echo "Available DEB files:" echo "Available DEB files:"
ls -la $CARGO_TARGET_DIR/release/bundle/deb/ || true ls -lt $CARGO_TARGET_DIR/release/bundle/deb/ 2>/dev/null || true
echo "Available RPM files:" echo "Available RPM files:"
ls -la $CARGO_TARGET_DIR/release/bundle/rpm/ || true ls -lt $CARGO_TARGET_DIR/release/bundle/rpm/ 2>/dev/null || true
# Copy from persistent cache location (excluding already-renamed Cinny-* files) # Copy from persistent cache location (get NEWEST file by modification time)
APPIMAGE=$(find $CARGO_TARGET_DIR/release/bundle/appimage -name "*.AppImage" -not -name "Cinny-Linux*" | head -1) APPIMAGE=$(ls -t $CARGO_TARGET_DIR/release/bundle/appimage/*.AppImage 2>/dev/null | head -1)
echo "Copying AppImage: $APPIMAGE" echo "Copying AppImage: $APPIMAGE"
cp "$APPIMAGE" src-tauri/target/release/bundle/appimage/Cinny-Linux-x64.AppImage cp "$APPIMAGE" src-tauri/target/release/bundle/appimage/Cinny-Linux-x64.AppImage
DEB=$(find $CARGO_TARGET_DIR/release/bundle/deb -name "*.deb" -not -name "Cinny-Linux*" | head -1) DEB=$(ls -t $CARGO_TARGET_DIR/release/bundle/deb/*.deb 2>/dev/null | head -1)
echo "Copying DEB: $DEB" echo "Copying DEB: $DEB"
cp "$DEB" src-tauri/target/release/bundle/deb/Cinny-Linux-x64.deb cp "$DEB" src-tauri/target/release/bundle/deb/Cinny-Linux-x64.deb
RPM=$(find $CARGO_TARGET_DIR/release/bundle/rpm -name "*.rpm" -not -name "Cinny-Linux*" | head -1) RPM=$(ls -t $CARGO_TARGET_DIR/release/bundle/rpm/*.rpm 2>/dev/null | head -1)
echo "Copying RPM: $RPM" echo "Copying RPM: $RPM"
cp "$RPM" src-tauri/target/release/bundle/rpm/Cinny-Linux-x64.rpm cp "$RPM" src-tauri/target/release/bundle/rpm/Cinny-Linux-x64.rpm
# Copy signature file for updater if it exists # Copy signature file for updater if it exists (get NEWEST)
if ls $CARGO_TARGET_DIR/release/bundle/appimage/*.AppImage.sig 1> /dev/null 2>&1; then if ls $CARGO_TARGET_DIR/release/bundle/appimage/*.AppImage.sig 1> /dev/null 2>&1; then
APPSIG=$(find $CARGO_TARGET_DIR/release/bundle/appimage -name "*.AppImage.sig" -not -name "Cinny-Linux*" | head -1) APPSIG=$(ls -t $CARGO_TARGET_DIR/release/bundle/appimage/*.AppImage.sig 2>/dev/null | head -1)
echo "Copying AppImage sig: $APPSIG" echo "Copying AppImage sig: $APPSIG"
cp "$APPSIG" src-tauri/target/release/bundle/appimage/Cinny-Linux-x64.AppImage.sig cp "$APPSIG" src-tauri/target/release/bundle/appimage/Cinny-Linux-x64.AppImage.sig
fi fi