-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrelease.ps1
More file actions
101 lines (84 loc) · 3.88 KB
/
release.ps1
File metadata and controls
101 lines (84 loc) · 3.88 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# openR-TYPE Release Script
param(
[Parameter(Mandatory=$true)]
[string]$Version
)
Write-Host "========================================" -ForegroundColor Cyan
Write-Host " openR-TYPE Release Builder v$Version" -ForegroundColor Cyan
Write-Host "========================================" -ForegroundColor Cyan
# Clean build
Write-Host "`n[1/6] Cleaning previous builds..." -ForegroundColor Yellow
cargo clean
if ($LASTEXITCODE -ne 0) {
Write-Host "Clean failed!" -ForegroundColor Red
exit 1
}
# Build release
Write-Host "`n[2/6] Building release binary..." -ForegroundColor Yellow
cargo build --release --bin openr-type
if ($LASTEXITCODE -ne 0) {
Write-Host "Build failed!" -ForegroundColor Red
exit 1
}
# Create release directory
Write-Host "`n[3/6] Creating release package..." -ForegroundColor Yellow
if (Test-Path "release") {
Remove-Item -Recurse -Force "release"
}
New-Item -ItemType Directory -Force -Path "release" | Out-Null
# Copy files
Copy-Item "target\release\openr-type.exe" -Destination "release\"
Copy-Item "README.md" -Destination "release\"
Copy-Item "LICENSE" -Destination "release\"
Copy-Item "QUICKSTART.md" -Destination "release\"
Copy-Item "CONFIG_GUIDE.md" -Destination "release\"
Copy-Item "HOTKEYS.md" -Destination "release\"
Copy-Item "AUDIO_GUIDE.md" -Destination "release\"
Write-Host " ✓ Copied executable and documentation" -ForegroundColor Green
# Create ZIP
Write-Host "`n[4/6] Creating ZIP archive..." -ForegroundColor Yellow
$zipName = "openr-type-v$Version-windows-x64.zip"
if (Test-Path $zipName) {
Remove-Item $zipName
}
Compress-Archive -Path "release\*" -DestinationPath $zipName -Force
Write-Host " ✓ Created $zipName" -ForegroundColor Green
# Get file size
$zipSize = (Get-Item $zipName).Length / 1MB
Write-Host " ✓ Size: $([math]::Round($zipSize, 2)) MB" -ForegroundColor Green
# Generate checksums
Write-Host "`n[5/6] Generating checksums..." -ForegroundColor Yellow
if (Test-Path "checksums.txt") {
Remove-Item "checksums.txt"
}
Write-Output "openR-TYPE v$Version - SHA256 Checksums" > checksums.txt
Write-Output "========================================`n" >> checksums.txt
Write-Output "Executable (openr-type.exe):" >> checksums.txt
certutil -hashfile "target\release\openr-type.exe" SHA256 | Select-Object -Skip 1 -First 1 >> checksums.txt
Write-Output "" >> checksums.txt
Write-Output "ZIP Archive ($zipName):" >> checksums.txt
certutil -hashfile $zipName SHA256 | Select-Object -Skip 1 -First 1 >> checksums.txt
Write-Host " ✓ Generated checksums.txt" -ForegroundColor Green
# Display results
Write-Host "`n[6/6] Release package ready!" -ForegroundColor Green
Write-Host "`n========================================" -ForegroundColor Cyan
Write-Host "Files created:" -ForegroundColor Cyan
Write-Host " - $zipName ($([math]::Round($zipSize, 2)) MB)"
Write-Host " - checksums.txt"
Write-Host " - release\ (directory with extracted files)"
Write-Host "`n========================================" -ForegroundColor Cyan
Write-Host "Next steps:" -ForegroundColor Cyan
Write-Host " 1. git add ." -ForegroundColor White
Write-Host " 2. git commit -m 'Release v$Version'" -ForegroundColor White
Write-Host " 3. git tag -a v$Version -m 'Release v$Version'" -ForegroundColor White
Write-Host " 4. git push origin main" -ForegroundColor White
Write-Host " 5. git push origin v$Version" -ForegroundColor White
Write-Host " 6. Create GitHub release and upload:" -ForegroundColor White
Write-Host " - $zipName" -ForegroundColor Yellow
Write-Host " - checksums.txt" -ForegroundColor Yellow
Write-Host "`n========================================" -ForegroundColor Cyan
Write-Host "Checksums:" -ForegroundColor Cyan
Get-Content checksums.txt
Write-Host "`n========================================" -ForegroundColor Green
Write-Host "Release build complete!" -ForegroundColor Green
Write-Host "========================================" -ForegroundColor Green