Skip to content

Commit 0624211

Browse files
committed
Update script
1 parent 1176583 commit 0624211

File tree

1 file changed

+24
-15
lines changed

1 file changed

+24
-15
lines changed

Scripts/validateMavenVersion.ps1

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,32 +29,41 @@ $web_client = New-Object System.Net.WebClient
2929

3030
$mavenAPIurl = 'https://search.maven.org/solrsearch/select?q=g:"com.microsoft.graph"+AND+a:"microsoft-graph-core"&core=gav&rows=20&wt=json'
3131
$jsonResult = $web_client.DownloadString($mavenAPIurl) | ConvertFrom-Json
32-
$mavenVersions = $jsonResult.response.docs.v.split(".")
33-
$mavenMajorVersion = [int]$mavenVersions[0]
34-
$mavenMinorVersion = [int]$mavenVersions[1]
35-
$mavenPatchVersion = [int]$mavenVersions[2]
32+
$mavenVersions = $jsonResult.response.docs.v
33+
$mavenSplit = $mavenVersions.split(".")
34+
$mavenMajorVersion = [int]$mavenSplit[0]
35+
$mavenMinorVersion = [int]$mavenSplit[1]
36+
$mavenPatchVersion = [int]$mavenSplit[2]
3637

3738
$bintrayAPIurl = 'https://api.bintray.com/search/packages?name=microsoft-graph-core'
3839
$jsonResult = $web_client.DownloadString($bintrayAPIurl) | ConvertFrom-Json
39-
$bintrayVersions = $jsonResult.latest_version.split(".")
40-
$bintrayMajorVersion = [int]$bintrayVersions[0]
41-
$bintrayMinorVersion = [int]$bintrayVersions[1]
42-
$bintrayPatchVersion = [int]$bintrayVersions[2]
40+
$bintrayVersions = $jsonResult.latest_version
41+
$bintraySplit = $bintrayVersions.split(".")
42+
$bintrayMajorVersion = [int]$bintraySplit[0]
43+
$bintrayMinorVersion = [int]$bintraySplit[1]
44+
$bintrayPatchVersion = [int]$bintraySplit[2]
45+
46+
47+
write-host 'The current version in the Maven central repository is:' $mavenVersions
48+
write-host 'The current version in the Bintray central repository is:' $bintrayVersions
4349

4450
if(($bintrayMinorVersion -ne $mavenMinorVersion) -OR
4551
($bintrayMajorversion -ne $mavenMajorVersion) -OR
4652
($bintraypatchversion -ne $mavenpatchversion))
4753
{
48-
"The current Maven and Bintray versions are not the same"
54+
Write-Warning "The current Maven and Bintray versions are not the same"
4955
}
50-
else {
51-
if(($localMajorVersion -gt $bintrayMajorVersion) -OR
56+
57+
if(($localMajorVersion -gt $bintrayMajorVersion) -OR
5258
($localMinorVersion -gt $bintrayMinorVersion) -OR
5359
($localPatchVersion -gt $bintrayPatchVersion))
54-
{
55-
"The current pull request is of a greater version"
56-
}
57-
}
60+
{
61+
write-host "The current pull request is of a greater version"
62+
}
63+
else
64+
{
65+
write-error "The local version has not been updated or is of an earlier version than that on the remote repository"
66+
}
5867

5968

6069

0 commit comments

Comments
 (0)