From ba636fe6fc0bfd529fca6d8b76006fc3000faa5f Mon Sep 17 00:00:00 2001 From: Max Litruv Boonzaayer Date: Fri, 20 Feb 2026 15:29:02 +1100 Subject: [PATCH] fix: update build script to sort files by modification time for better accuracy --- .gitea/workflows/build.yml | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index 7bd6a65..d03b515 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -116,22 +116,22 @@ jobs: if (Test-Path $outDir) { Remove-Item -Recurse -Force $outDir } 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" 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 - Write-Host "Found MSI: $($msi.FullName) (Size: $($msi.Length) bytes)" + $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, Modified: $($msi.LastWriteTime))" 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) { Write-Host "Found MSI.zip: $($msiZip.FullName)" 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) { Write-Host "Found MSI.zip.sig: $($msiZipSig.FullName)" 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/rpm - # Show what's available in cache + # Show what's available in cache (sorted by time, newest first) 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:" - 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:" - 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) - APPIMAGE=$(find $CARGO_TARGET_DIR/release/bundle/appimage -name "*.AppImage" -not -name "Cinny-Linux*" | head -1) + # Copy from persistent cache location (get NEWEST file by modification time) + APPIMAGE=$(ls -t $CARGO_TARGET_DIR/release/bundle/appimage/*.AppImage 2>/dev/null | head -1) echo "Copying AppImage: $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" 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" 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 - 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" cp "$APPSIG" src-tauri/target/release/bundle/appimage/Cinny-Linux-x64.AppImage.sig fi