-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpackage-release.ps1
More file actions
61 lines (49 loc) · 2.05 KB
/
package-release.ps1
File metadata and controls
61 lines (49 loc) · 2.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# Package Release for GitHub
# Run this after building in Release mode to create a distributable package
param(
[Parameter(Mandatory=$false)]
[string]$Version
)
$projectDir = $PSScriptRoot
$publishDir = Join-Path $projectDir "bin\Release\net8.0-windows\publish"
$outputDir = Join-Path $projectDir "releases"
# Get version from version.json if not provided
if (-not $Version) {
$versionFile = Join-Path $projectDir "version.json"
if (Test-Path $versionFile) {
$json = Get-Content $versionFile -Raw | ConvertFrom-Json
$Version = $json.version
} else {
$Version = "1.0.0"
}
}
Write-Host "Packaging SQLTriage v$Version for GitHub Release..." -ForegroundColor Cyan
# Create releases directory if it doesn't exist
if (-not (Test-Path $outputDir)) {
New-Item -ItemType Directory -Path $outputDir | Out-Null
}
# Check if publish directory exists
if (-not (Test-Path $publishDir)) {
Write-Host "ERROR: Publish directory not found. Please build in Release mode first:" -ForegroundColor Red
Write-Host " dotnet publish -c Release" -ForegroundColor Yellow
exit 1
}
# Create zip file
$zipName = "SQLTriage-v$Version-win-x64.zip"
$zipPath = Join-Path $outputDir $zipName
Write-Host "Creating package: $zipName" -ForegroundColor Green
# Remove old zip if exists
if (Test-Path $zipPath) {
Remove-Item $zipPath -Force
}
# Create zip
Compress-Archive -Path "$publishDir\*" -DestinationPath $zipPath -CompressionLevel Optimal
$zipSize = (Get-Item $zipPath).Length / 1MB
Write-Host "Package created successfully: $([math]::Round($zipSize, 2)) MB" -ForegroundColor Green
Write-Host "Location: $zipPath" -ForegroundColor Cyan
Write-Host "`nNext steps:" -ForegroundColor Yellow
Write-Host "1. Go to: https://github.com/SQLAdrian/SQLTriage/releases/new" -ForegroundColor White
Write-Host "2. Tag version: v$Version" -ForegroundColor White
Write-Host "3. Release title: SQLTriage v$Version" -ForegroundColor White
Write-Host "4. Upload: $zipPath" -ForegroundColor White
Write-Host "5. Add release notes and publish" -ForegroundColor White