-
Notifications
You must be signed in to change notification settings - Fork 0
/
SetVersion.ps1
62 lines (56 loc) · 1.45 KB
/
SetVersion.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
param(
[Parameter(Mandatory=$true)][string]$AlmonasterVersion,
[Parameter(Mandatory=$true)][string]$AlajarVersion
)
$file = './Source/Almonaster/GameEngine/GameEngine.cpp'
$content = Get-Content -Path $file
Remove-Item -Path $file
ForEach ($row in $content)
{
if ($row.Contains('#define ALMONASTER_VERSION'))
{
Add-Content -Path $file ('#define ALMONASTER_VERSION ' + $AlmonasterVersion)
}
else
{
Add-Content -Path $file $row
}
}
$file = './Source/AlajarDll/HttpServer.h'
$content = Get-Content -Path $file
Remove-Item -Path $file
ForEach ($row in $content)
{
if ($row.Contains('#define ALAJAR_VERSION'))
{
Add-Content -Path $file ('#define ALAJAR_VERSION ' + $AlajarVersion)
}
else
{
Add-Content -Path $file $row
}
}
$file = './.github/workflows/release.yml'
$content = Get-Content -Path $file
Remove-Item -Path $file
ForEach ($row in $content)
{
if ($row.Contains('/almonaster-'))
{
$startIndex = $row.IndexOf('/almonaster-')
if ($startIndex -ne -1)
{
$startIndex += '/almonaster-'.Length
$endIndex = $row.IndexOf('-', $startIndex)
if ($endIndex -ne -1)
{
$newRow = $row.Substring(0, $startIndex) + $AlmonasterVersion + $row.SubString($endIndex)
Add-Content -Path $file $newRow
}
}
}
else
{
Add-Content -Path $file $row
}
}