-
Notifications
You must be signed in to change notification settings - Fork 19
/
release.ps1
40 lines (35 loc) · 986 Bytes
/
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
$7z = "$env:ProgramFiles\7-Zip\7z.exe"
if (-not (test-path $7z)) {throw $7z + " needed"}
$CI = $env:APPVEYOR -eq "True"
if($CI)
{
$BuildFolder = $env:APPVEYOR_BUILD_FOLDER + "\GzsTool\bin\Release\"
if ($env:APPVEYOR_REPO_TAG -eq "True")
{
$Version = ".$env:APPVEYOR_REPO_TAG_NAME"
}
else
{
$Version = ".$env:APPVEYOR_BUILD_VERSION"
}
}
else
{
$BuildFolder = ".\GzsTool\bin\Release\"
$AssemblyInfoFile = ".\GzsTool\Properties\AssemblyInfo.cs"
$Version = select-string -Path $AssemblyInfoFile -Pattern "AssemblyVersion\(`"(?<AssemblyVersion>.*)`"\)"| Select -Expand Matches | Foreach { $_.Groups["AssemblyVersion"] }
if($Version)
{
$Version = "." + $Version
}
}
$ReleaseFileName = "GzsTool$Version.zip"
& $7z a $ReleaseFileName $BuildFolder*.dll $BuildFolder*.txt $BuildFolder*.exe $BuildFolder*.config "-x!*.vshost.*"
if($CI)
{
Push-AppveyorArtifact $ReleaseFileName
}
else
{
Move-Item $ReleaseFileName ".\Releases\$ReleaseFileName" -force
}