Skip to content

Commit edb36cb

Browse files
authored
Merge pull request #864 from microsoftgraph/rsh/getLatestVersionPatch
Update getLatestVersion.ps1
2 parents 1fc1d12 + daebb61 commit edb36cb

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

Scripts/getLatestVersion.ps1

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,12 @@ $file = get-item $propertiesPath
2121
$findVersions = $file | Select-String -Pattern "mavenMajorVersion" -Context 0,2
2222
$findVersions = $findVersions -split "`r`n"
2323

24-
$majorVersion = $findVersions[0].Substring($findVersions[0].Length-1)
25-
$minorVersion = $findVersions[1].Substring($findVersions[1].Length-1)
26-
$patchVersion = $findVersions[2].Substring($findVersions[2].Length-1)
24+
$versionIndex = $findVersions[0].IndexOf("=")
25+
$majorVersion = $findVersions[0].Substring($versionIndex+2)
26+
$minorVersion = $findVersions[1].Substring($versionIndex+2)
27+
$patchVersion = $findVersions[2].Substring($versionIndex+2)
2728
$version = "$majorVersion.$minorVersion.$patchVersion"
2829

2930
#Update the VERSION_STRING env variable and inform the user
3031
Write-Host "##vso[task.setVariable variable=VERSION_STRING]$($version)";
31-
Write-Host "Updated the VERSION_STRING enviornment variable with the current Gradle.Properties, $version"
32+
Write-Host "Updated the VERSION_STRING enviornment variable with the current Gradle.Properties, $version"

0 commit comments

Comments
 (0)