forked from mcu8/OpenModManager
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCreate-Release-Files.ps1
More file actions
38 lines (26 loc) · 1.51 KB
/
Create-Release-Files.ps1
File metadata and controls
38 lines (26 loc) · 1.51 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
Clear-Host
$scriptpath = $MyInvocation.MyCommand.Path
$dir = Split-Path $scriptpath
Write-host "My directory is $dir"
$devenv = "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\devenv.com"
$outputDir = Join-Path -Path $dir -Child "Release"
$tmpDir = Join-Path -Path $outputDir -Child ".tmp"
Remove-Item -Path $outputDir\*.* -Force -Recurse
New-Item -Path $tmpDir -ItemType Directory -ErrorAction Ignore
Remove-Item -Path $tmpDir\* -Force -Recurse
$ommFiles = Join-Path -Path $dir -Child "ModdingTools.Cli\bin\Release"
$ommUpdaterFiles = Join-Path -Path $dir -Child "ModdingTools.Updater\bin\Release"
Remove-Item -Force $ommFiles\*
Remove-Item -Force $ommUpdaterFiles\*
$csproj = Join-Path -Path $dir -Child "OpenModManager.sln"
& $devenv "$csproj" /build "Release|Any CPU"
Write-Host $ommFiles
Copy-Item -Path $ommFiles\* -Recurse -Destination $tmpDir
Write-Host $ommUpdaterFiles
Copy-Item -Path $ommUpdaterFiles\* -Recurse -Destination $tmpDir
Move-Item -Path $tmpDir\ModdingTools.Updater.exe -Destination $tmpDir\ModdingTools.Updater.New.exe
Move-Item -Path $tmpDir\ModdingTools.Updater.pdb -Destination $tmpDir\ModdingTools.Updater.New.pdb
Compress-Archive -Path $tmpDir\* -DestinationPath $outputDir\OpenModManager-bin.zip
Remove-Item -Path $tmpDir -Recurse -Force
$sha256 = Get-FileHash $outputDir\OpenModManager-bin.zip -Algorithm SHA256 | Select-Object -ExpandProperty Hash
[IO.File]::WriteAllText("$outputDir\OpenModManager-bin.zip.sha256", ("$sha256".ToLower() + " OpenModManager-bin.zip") -join "`n")