forked from Azure/azure-functions-kafka-extension
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate-version.ps1
71 lines (54 loc) · 2.04 KB
/
update-version.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
#ENTRY POINT MAIN()
Param(
[Parameter(Mandatory=$True)]
[String]
$oldVersion,
[Parameter(Mandatory=$True)]
[String]
$newVersion,
[Parameter(Mandatory=$True)]
[String]
$oldExtensionVersion,
[Parameter(Mandatory=$True)]
[String]
$newExtensionVersion
)
function Update-HostVersion {
param (
$newVersion,
$oldVersion,
$Directory
)
$csprojFiles = Get-ChildItem ./$Directory/*.csproj -rec
foreach ($f in $csprojFiles)
{
$content = Get-Content $f.PSPath
Write-Host "Updating version in $($f.PSPath) to $newVersion"
$old = '"Confluent.Kafka" Version="'+ $oldVersion
$new = '"Confluent.Kafka" Version="'+ $newVersion
$newContent = $content | % { $_ -replace $old, $new }
$old = '"Confluent.SchemaRegistry" Version="' + $oldVersion
$new = '"Confluent.SchemaRegistry" Version="' + $newVersion
$newContent = $newContent | % { $_ -replace $old, $new }
$old = '"Confluent.SchemaRegistry.Serdes.Avro" Version="' + $oldVersion
$new = '"Confluent.SchemaRegistry.Serdes.Avro" Version="' + $newVersion
$newContent = $newContent | % { $_ -replace $old, $new }
$old = '"Confluent.SchemaRegistry.Serdes.Protobuf" Version="' + $oldVersion
$new = '"Confluent.SchemaRegistry.Serdes.Protobuf" Version="' + $newVersion
$newContent = $newContent | % { $_ -replace $old, $new }
Set-Content -Path $f.PSPath -Value $newContent
}
}
function Update-ExtensionVersion{
param(
$oldExtensionVersion,
$newExtensionVersion
)
$path = ".\build\common.props"
$old = "<Version>" + $oldExtensionVersion
$new = "<Version>" + $newExtensionVersion
$newContent = Get-Content $path | % { $_ -replace $old, $new }
Set-Content -Path $path -Value $newContent
}
Update-HostVersion -oldVersion $oldVersion -newVersion $newVersion -Directory .
Update-ExtensionVersion -oldExtensionVersion $oldExtensionVersion -newExtensionVersion $newExtensionVersion