4
4
# NOTE: This scripts only updates patch version by incrementing the next patch version.
5
5
# If Microsoft ever releases a minor version, this needs to updated accordingly to include minor version.
6
6
7
- param ([Parameter (Mandatory )]$DockerfilePath )
7
+ param ([Parameter (Mandatory )]$DockerfilePath , [ Parameter ( Mandatory )] $NextVersion )
8
8
9
9
# Updates the Dockerfile with next ASP.NET Core version and checksum512 hash if available
10
- function Update-Dockerfile ([string ]$DockerfilePath ) {
10
+ function Update-Dockerfile ([string ]$DockerfilePath , [ string ] $NextVersion ) {
11
11
Write-Host " Updating $DockerfilePath with next ASP.NET Core version"
12
12
13
- $nextVersion = Get-NextASPNETVersion - DockerfilePath $DockerfilePath
13
+ $checksumFilePath = " ${NextVersion} -checksum.txt "
14
14
15
- $checksumFilePath = " ${nextVersion} -checksum.txt"
16
-
17
- $checksumUri = " https://dotnetcli.blob.core.windows.net/dotnet/checksums/${nextVersion} -sha.txt"
15
+ $checksumUri = " https://dotnetcli.blob.core.windows.net/dotnet/checksums/${NextVersion} -sha.txt"
18
16
Write-Host " Downloading checksums from $checksumUri "
19
17
20
18
Invoke-WebRequest - Uri $checksumUri - OutFile $checksumFilePath
21
19
22
20
$arch = Get-Architecture - DockerfilePath $DockerfilePath
23
21
24
- $artifact = " aspnetcore-runtime-${nextVersion } -linux-${arch} .tar.gz"
22
+ $artifact = " aspnetcore-runtime-${NextVersion } -linux-${arch} .tar.gz"
25
23
$checksum = Get-Checksum - Artifact $artifact - DockerfilePath $checksumFilePath
26
24
27
- (Get-Content $DockerfilePath ) -replace ' ARG ASPNET_VERSION=.*' , " ARG ASPNET_VERSION=${nextVersion } " -replace ' ARG ASPNET_SHA512=.*' , " ARG ASPNET_SHA512=${checksum} " | Out-File $DockerfilePath
25
+ (Get-Content $DockerfilePath ) -replace ' ARG ASPNET_VERSION=.*' , " ARG ASPNET_VERSION=${NextVersion } " -replace ' ARG ASPNET_SHA512=.*' , " ARG ASPNET_SHA512=${checksum} " | Out-File $DockerfilePath
28
26
29
- Write-Host " Updated ${DockerfilePath} to ${nextVersion } ."
27
+ Write-Host " Updated ${DockerfilePath} to ${NextVersion } ."
30
28
31
29
# This allows checksumring the $DockerfilePath variable between steps
32
30
# which is needed to update the description of the PR
33
- Write-Host " ::set-output name=${DockerfilePath} ::- Updated ${DockerfilePath} to ${nextVersion } <br> - Artifact: ${artifact} <br> - Checksum Source: ${checksumUri} "
31
+ Write-Host " ::set-output name=${DockerfilePath} ::- Updated ${DockerfilePath} to ${NextVersion } <br> - Artifact: ${artifact} <br> - Checksum Source: ${checksumUri} "
34
32
}
35
33
36
34
# Returns Checksum of given ASP.NET Core version from the give Checksum file
@@ -53,27 +51,4 @@ function Get-Architecture ([string]$DockerfilePath) {
53
51
}
54
52
}
55
53
56
- # Returns the next ASP.NET version to be updated in the Dockerfile
57
- function Get-NextASPNETVersion ([string ]$DockerfilePath ) {
58
- $line = Select-String - Path $DockerfilePath - Pattern " ARG ASPNET_VERSION=" | Select-Object - Property Line - ExpandProperty Line
59
- $currentVersion = $line.Split (" =" )[1 ]
60
- Write-Host " Current ASPNET version: ${currentVersion} "
61
-
62
- $nextVersion = Update-PatchVersion - Version $currentVersion
63
- Write-Host " Next ASPNET version: ${nextVersion} "
64
-
65
- return $nextVersion
66
- }
67
-
68
- # Returns the next patch version of the given version
69
- function Update-PatchVersion ([string ]$version ) {
70
- $components = $version.Split (" ." );
71
- $major = $components [0 ];
72
- $minor = $components [1 ];
73
- $patch = $components [2 ];
74
- $patch = [int ]$patch + 1 ;
75
- $newVersion = $major + " ." + $minor + " ." + $patch ;
76
- return $newVersion ;
77
- }
78
-
79
- Update-Dockerfile $DockerfilePath
54
+ Update-Dockerfile $DockerfilePath $NextVersion
0 commit comments