-
Notifications
You must be signed in to change notification settings - Fork 64
/
Release.ps1
95 lines (77 loc) · 3.19 KB
/
Release.ps1
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
param
(
[Parameter(Mandatory=$true)] [String] $ReleaseNumber,
[Switch] $BranchAlreadyExists,
[Switch] $Preview
)
if (($ReleaseNumber.Length -ne 3) -and -not $Preview)
{
write-host You must provide a 3-digit release number.
exit
}
Remove-Item -Recurse Apps\PcmHammer\bin\debug -ErrorAction SilentlyContinue
Remove-Item -Recurse Apps\PcmLogger\bin\debug -ErrorAction SilentlyContinue
Remove-Item -Recurse Release -ErrorAction SilentlyContinue;
Remove-Item -Recurse "PcmHammer$ReleaseNumber" -ErrorAction SilentlyContinue
if (-not $Preview)
{
if (-not $BranchAlreadyExists)
{
git checkout develop
git checkout -b "Release/$ReleaseNumber"
}
write-host ===============================================================================
write-host = Updating version in help.html
$file = "Apps\PcmHammer\help.html"
$find = " <h1>PCM Hammer Development Release</h1>"
$replace = " <h1>PCM Hammer Release $ReleaseNumber</h1>"
(Get-Content $file).Replace($find, $replace) | Set-Content $file
git add $file
write-host ===============================================================================
write-host = Updating version in PcmHammer MainForm.cs
$file = "Apps\PcmHammer\MainForm.cs"
$find = " private const string AppVersion = null;"
$replace = ' private const string AppVersion = "' + $ReleaseNumber + '";'
(Get-Content $file).Replace($find, $replace) | Set-Content $file
git add $file
write-host ===============================================================================
write-host = Running difftool - confirm changes to MainForm.cs and help.html now.
git difftool --cached
}
else
{
$ReleaseNumber = "$ReleaseNumber-Preview"
}
# Should call "dotnet build" here
write-host "Rebuild all in Visual Studio now."
read-host -Prompt "Press Enter to continue..."
write-host ===============================================================================
write-host = Rebuilding kernel
cd Kernels
.\build.bat
cd ..
write-host ===============================================================================
write-host = Copying files to release directory
$unused = mkdir Release
copy Kernels\*.bin Release
copy Apps\PcmHammer\bin\Debug\PcmHammer.* Release
copy Apps\PcmHammer\bin\Debug\*.dll Release
copy Apps\PcmHammer\bin\Debug\*.pdb Release
copy Apps\PcmLogger\bin\Debug\PcmLogger.* Release
copy Apps\PcmLogger\bin\Debug\*.dll Release
copy Apps\PcmLogger\bin\Debug\*.pdb Release
copy Apps\PcmLogger\*.LogProfile Release
copy Apps\PcmLogger\Parameters.*.xml Release
copy Apps\VpwExplorer\bin\Debug\VpwExplorer.* Release
copy Apps\VpwExplorer\bin\Debug\*.dll Release
copy Apps\VpwExplorer\bin\Debug\*.pdb Release
# The order of these two operations matters - it ensures that the zip file contains a directory named PcmHammerNNN.
Rename-Item Release "PcmHammer$ReleaseNumber"
7z.exe a -r "PcmHammer$ReleaseNumber.zip" "PcmHammer$ReleaseNumber\*.*"
if (-not $Preview)
{
write-host ========================== WARNING ===============================
write-host You still need to commit the changes to MainForm.cs and help.html.
write-host ========================== WARNING ===============================
}
git status