-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVersion.ps1
More file actions
31 lines (28 loc) · 1010 Bytes
/
Version.ps1
File metadata and controls
31 lines (28 loc) · 1010 Bytes
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
# change these:
###################
$major = "2"
$minor = "0"
###################
$pattern = '^\[assembly: AssemblyVersion\("(.*)"\)\]'
$assemblyFiles = Get-ChildItem -Recurse . AssemblyInfo.cs
$nugetIndexStr = curl https://api.github.com/repos/oledid/oledid.SyntaxImprovement/releases/latest -s | jq .name -r
if ($nugetIndexStr -match "v(\d+)\.(\d+)\.(\d+)") {
$lastPackageMajor = $matches[1]
$lastPackageMinor = $matches[2]
$lastPackageBuildNo = $matches[3]
}
else {
$lastPackageMajor = "0"
$lastPackageMinor = "0"
$lastPackageBuildNo = "0"
}
$buildCounter = ([long]$lastPackageBuildNo + 1).ToString()
if ("$major.$minor" -ne "$lastPackageMajor.$lastPackageMinor") {
$buildCounter = "0"
}
$build = $buildCounter
$revision = "0"
$newVersion = "{0}.{1}.{2}" -f $major, $minor, $build
$newAssemblyVersion = "{0}.{1}.{2}.{3}" -f $major, $minor, $build, $revision
$build_version = "{0}.{1}.{2}-beta" -f $major, $minor, $build;
Write-Host "Variables set, `$build_version = $build_version"