246 lines
9.3 KiB
PowerShell
246 lines
9.3 KiB
PowerShell
param(
|
||
[ValidateSet("major", "minor", "patch", "current")]
|
||
[string]$Type = "current",
|
||
[string]$Message = ""
|
||
)
|
||
|
||
$ErrorActionPreference = "Stop"
|
||
$root = $PSScriptRoot
|
||
if (-not $root) { $root = (Get-Location).Path }
|
||
|
||
$versionFile = Join-Path $root "version.json"
|
||
$propsFile = Join-Path $root "Directory.Build.props"
|
||
|
||
if (-not (Test-Path $versionFile)) {
|
||
@{ major = 2; minor = 8; patch = 0; version = "2.8.0" } | ConvertTo-Json | Set-Content $versionFile
|
||
}
|
||
|
||
$vData = Get-Content $versionFile -Raw | ConvertFrom-Json
|
||
$major = [int]$vData.major
|
||
$minor = [int]$vData.minor
|
||
$patch = [int]$vData.patch
|
||
|
||
switch ($Type.ToLowerInvariant()) {
|
||
"major" {
|
||
$major += 1
|
||
$minor = 0
|
||
$patch = 0
|
||
}
|
||
"minor" {
|
||
$minor += 1
|
||
$patch = 0
|
||
}
|
||
"patch" {
|
||
$patch += 1
|
||
}
|
||
"current" {
|
||
# Keep existing version
|
||
}
|
||
}
|
||
|
||
$newVersion = "$major.$minor.$patch"
|
||
$vData.major = $major
|
||
$vData.minor = $minor
|
||
$vData.patch = $patch
|
||
$vData.version = $newVersion
|
||
|
||
$vData | ConvertTo-Json | Set-Content $versionFile -Encoding UTF8
|
||
|
||
# Update Directory.Build.props
|
||
$propsContent = @"
|
||
<Project>
|
||
<PropertyGroup>
|
||
<Version>$newVersion</Version>
|
||
<AssemblyVersion>$newVersion.0</AssemblyVersion>
|
||
<FileVersion>$newVersion.0</FileVersion>
|
||
<Product>LD Uninstaller</Product>
|
||
<Company>LD Software</Company>
|
||
<Authors>LD Software</Authors>
|
||
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
||
</PropertyGroup>
|
||
</Project>
|
||
"@
|
||
Set-Content -Path $propsFile -Value $propsContent -Encoding UTF8
|
||
|
||
Write-Host "==========================================================" -ForegroundColor Cyan
|
||
Write-Host " LD UNINSTALLER WEB YAYIN PAKETLEYICI: v$newVersion" -ForegroundColor Yellow
|
||
Write-Host " Hedef Web Adresi: https://ttmadethat.shop/#ldapps" -ForegroundColor Green
|
||
Write-Host "==========================================================" -ForegroundColor Cyan
|
||
|
||
# 1. Eski gecici dosyalari ve onceki paket klasorlerini temizle
|
||
$oldFolders = Get-ChildItem -Path $root -Directory -Filter "LD Uninstaller v*"
|
||
foreach ($old in $oldFolders) {
|
||
Write-Host "Eski surum klasoru temizleniyor: $($old.Name)..." -ForegroundColor Gray
|
||
try {
|
||
Remove-Item -Path $old.FullName -Recurse -Force -ErrorAction SilentlyContinue
|
||
} catch { }
|
||
}
|
||
|
||
Get-ChildItem -Path $root -File -Filter "LD-Uninstaller-Setup-v*.exe" | Remove-Item -Force -ErrorAction SilentlyContinue
|
||
Get-ChildItem -Path $root -File -Filter "LD-Uninstaller-v*.zip" | Remove-Item -Force -ErrorAction SilentlyContinue
|
||
Get-ChildItem -Path $root -File -Filter "LD-Uninstaller-Portable-*.zip" | Remove-Item -Force -ErrorAction SilentlyContinue
|
||
|
||
try { Remove-Item -Path (Join-Path $root "publish") -Recurse -Force -ErrorAction SilentlyContinue } catch { }
|
||
try { Remove-Item -Path (Join-Path $root "dist") -Recurse -Force -ErrorAction SilentlyContinue } catch { }
|
||
|
||
$webUploadDir = Join-Path $root "web_upload"
|
||
if (Test-Path $webUploadDir) {
|
||
Remove-Item -Path $webUploadDir -Recurse -Force -ErrorAction SilentlyContinue
|
||
}
|
||
New-Item -ItemType Directory -Path $webUploadDir -Force | Out-Null
|
||
|
||
$targetFolderName = "LD Uninstaller v$newVersion"
|
||
$targetDir = Join-Path $root $targetFolderName
|
||
|
||
Write-Host "Yeni surum klasoru olusturuluyor: $targetFolderName..." -ForegroundColor Green
|
||
New-Item -ItemType Directory -Path $targetDir -Force | Out-Null
|
||
|
||
# 2. Projeleri Release modunda derle ve yayinla
|
||
Write-Host "`nProjeler Release modunda derleniyor..." -ForegroundColor Cyan
|
||
|
||
$projects = @(
|
||
"src/LDUninstaller.UI/LDUninstaller.UI.csproj",
|
||
"src/LDUninstaller.CLI/LDUninstaller.CLI.csproj",
|
||
"src/LDUninstaller.Automatizer/LDUninstaller.Automatizer.csproj",
|
||
"src/LDUninstaller.Launcher/LDUninstaller.Launcher.csproj"
|
||
)
|
||
|
||
foreach ($proj in $projects) {
|
||
$projPath = Join-Path $root $proj
|
||
Write-Host " -> Yayinlaniyor: $proj" -ForegroundColor Gray
|
||
dotnet publish $projPath -c Release -o $targetDir --nologo -v q
|
||
if ($LASTEXITCODE -ne 0) {
|
||
throw "Proje derlenemedi veya yayinlanamadi: $proj (ExitCode: $LASTEXITCODE)"
|
||
}
|
||
}
|
||
|
||
# Gereksiz pdb dosyalarini temizle
|
||
Get-ChildItem -Path $targetDir -Filter "*.pdb" | Remove-Item -Force -ErrorAction SilentlyContinue
|
||
Copy-Item (Join-Path $root "app.ico") (Join-Path $targetDir "app.ico") -Force
|
||
|
||
# 3. Inno Setup ile Setup.exe derle
|
||
$cmdIscc = Get-Command iscc.exe -ErrorAction SilentlyContinue | Select-Object -ExpandProperty Source
|
||
$isccCandidates = @(
|
||
$cmdIscc,
|
||
"C:\Users\lildosto\AppData\Local\Programs\Inno Setup 6\ISCC.exe",
|
||
"C:\Program Files (x86)\Inno Setup 6\ISCC.exe",
|
||
"C:\Program Files\Inno Setup 6\ISCC.exe"
|
||
)
|
||
$isccPath = $null
|
||
foreach ($cand in $isccCandidates) {
|
||
if ($cand -and (Test-Path $cand)) { $isccPath = $cand; break }
|
||
}
|
||
|
||
$setupName = "LD-Uninstaller-Setup-v$newVersion.exe"
|
||
$setupPath = Join-Path $root $setupName
|
||
|
||
if ($isccPath -and (Test-Path (Join-Path $root "installer.iss"))) {
|
||
Write-Host "`nWindows Kurulum Sihirbazi (Setup.exe) derleniyor..." -ForegroundColor Cyan
|
||
& $isccPath /Q "/DMyAppVersion=$newVersion" "/DSourceDir=$targetDir" (Join-Path $root "installer.iss")
|
||
if ($LASTEXITCODE -ne 0) {
|
||
throw "Inno Setup derleme hatasi! (ExitCode: $LASTEXITCODE)"
|
||
}
|
||
} else {
|
||
Write-Host "UYARI: Inno Setup derleyicisi (ISCC.exe) bulunamadi." -ForegroundColor Yellow
|
||
}
|
||
|
||
# 4. Web Yayin Klasorune (web_upload) Dosyalari Hazirla
|
||
Write-Host "`nWeb yayin dosyalari 'web_upload/' klasorune kopyalaniyor..." -ForegroundColor Cyan
|
||
|
||
# 4.1 Setup.exe kopyala
|
||
$webSetupPath = Join-Path $webUploadDir $setupName
|
||
$webSetupLatestPath = Join-Path $webUploadDir "LD-Uninstaller-Setup-latest.exe"
|
||
|
||
if (Test-Path $setupPath) {
|
||
Copy-Item $setupPath $webSetupPath -Force
|
||
Copy-Item $setupPath $webSetupLatestPath -Force
|
||
Write-Host " [+] $setupName eklendi" -ForegroundColor Green
|
||
Write-Host " [+] LD-Uninstaller-Setup-latest.exe eklendi" -ForegroundColor Green
|
||
}
|
||
|
||
# 4.2 Portable ZIP olustur
|
||
$zipName = "LD-Uninstaller-Portable-v$newVersion.zip"
|
||
$webZipPath = Join-Path $webUploadDir $zipName
|
||
$webZipLatestPath = Join-Path $webUploadDir "LD-Uninstaller-Portable-latest.zip"
|
||
|
||
Write-Host " [+] Portable ZIP arsivi olusturuluyor: $zipName..." -ForegroundColor Cyan
|
||
Compress-Archive -Path "$targetDir\*" -DestinationPath $webZipPath -Force
|
||
Copy-Item $webZipPath $webZipLatestPath -Force
|
||
Write-Host " [+] $zipName eklendi" -ForegroundColor Green
|
||
Write-Host " [+] LD-Uninstaller-Portable-latest.zip eklendi" -ForegroundColor Green
|
||
|
||
# 4.3 SHA256 Hash'lerini hesapla
|
||
$setupHash = ""
|
||
$setupSize = 0
|
||
if (Test-Path $webSetupPath) {
|
||
$setupHash = (Get-FileHash -Path $webSetupPath -Algorithm SHA256).Hash
|
||
$setupSize = (Get-Item $webSetupPath).Length
|
||
}
|
||
|
||
$zipHash = ""
|
||
$zipSize = 0
|
||
if (Test-Path $webZipPath) {
|
||
$zipHash = (Get-FileHash -Path $webZipPath -Algorithm SHA256).Hash
|
||
$zipSize = (Get-Item $webZipPath).Length
|
||
}
|
||
|
||
# 4.4 Web icin version.json olustur
|
||
$notesText = if (![string]::IsNullOrWhiteSpace($Message)) {
|
||
$Message
|
||
} else {
|
||
"v${newVersion}: Gelismis veri koruma kalkani, Geri Donusum Kutusu entegrasyonu, Yedekleme ve Koruma Merkezi, Zorla Kaldir modu, Winget script uretici ve yuksek hizli 20 katmanli kalinti tarama motoru."
|
||
}
|
||
|
||
$webVersionData = [ordered]@{
|
||
version = $newVersion
|
||
downloadUrl = "https://ttmadethat.shop/downloads/$setupName"
|
||
latestUrl = "https://ttmadethat.shop/downloads/LD-Uninstaller-Setup-latest.exe"
|
||
portableUrl = "https://ttmadethat.shop/downloads/$zipName"
|
||
homepageUrl = "https://ttmadethat.shop/#ldapps"
|
||
releaseDate = (Get-Date).ToString("yyyy-MM-dd HH:mm:ss")
|
||
releaseNotes = $notesText
|
||
sha256 = $setupHash
|
||
portableSha256 = $zipHash
|
||
setupSizeBytes = $setupSize
|
||
portableSizeBytes = $zipSize
|
||
}
|
||
|
||
$webVersionJsonPath = Join-Path $webUploadDir "version.json"
|
||
$webVersionData | ConvertTo-Json -Depth 5 | Set-Content -Path $webVersionJsonPath -Encoding UTF8
|
||
Write-Host " [+] version.json (Web API/Update Denetleyicisi) olusturuldu" -ForegroundColor Green
|
||
|
||
# 4.5 sha256.txt olustur
|
||
$shaContent = @"
|
||
================================================================================
|
||
LD Uninstaller v$newVersion - Dosya Doğrulama ve SHA256 Bilgileri
|
||
Yayın Tarihi: $((Get-Date).ToString("yyyy-MM-dd HH:mm:ss"))
|
||
Resmi Web: https://ttmadethat.shop/#ldapps
|
||
================================================================================
|
||
|
||
1. Kurulum Sihirbazı (Setup):
|
||
Dosya: $setupName
|
||
Boyut: $([math]::Round($setupSize / 1MB, 2)) MB ($setupSize bytes)
|
||
SHA256: $setupHash
|
||
|
||
2. Kurulumsuz Sürüm (Portable ZIP):
|
||
Dosya: $zipName
|
||
Boyut: $([math]::Round($zipSize / 1MB, 2)) MB ($zipSize bytes)
|
||
SHA256: $zipHash
|
||
|
||
================================================================================
|
||
Doğrulama Komutu (PowerShell):
|
||
Get-FileHash -Algorithm SHA256 .\$setupName
|
||
"@
|
||
|
||
$shaFilePath = Join-Path $webUploadDir "sha256.txt"
|
||
[System.IO.File]::WriteAllText($shaFilePath, $shaContent, [System.Text.Encoding]::UTF8)
|
||
Write-Host " [+] sha256.txt (Dogrulama Metni) olusturuldu" -ForegroundColor Green
|
||
|
||
# 5. Ozet Bilgisi
|
||
Write-Host "`n==========================================================" -ForegroundColor Green
|
||
Write-Host " YAYIN DOSYALARI HAZIR! (web_upload/)" -ForegroundColor Yellow
|
||
Write-Host "==========================================================" -ForegroundColor Green
|
||
Write-Host "Sunucuya (ttmadethat.shop) yuklenecek klasor:" -ForegroundColor Cyan
|
||
Write-Host " -> $webUploadDir`n" -ForegroundColor White
|
||
|
||
Get-ChildItem -Path $webUploadDir | Format-Table Name, Length, LastWriteTime
|