@@ -43,7 +43,6 @@ extends:
4343 # TODO maybe missing template context with sdl baselines?
4444 steps :
4545 - checkout : self
46- persistCredentials : true
4746
4847 - task : JavaToolInstaller@1
4948 inputs :
@@ -68,26 +67,26 @@ extends:
6867
6968 - script : ./gradlew --no-daemon publishToMavenLocal -PmavenCentralPublishingEnabled=true -PmavenCentralSnapshotArtifactSuffix=""
7069 displayName : Publish to local Maven for verification
71- # condition: contains(variables['build.sourceBranch'], 'refs/tags/v')
70+ condition : contains(variables['build.sourceBranch'], 'refs/tags/v')
7271
73- # - script: ./gradlew --no-daemon publishToMavenLocal -PmavenCentralPublishingEnabled=true
74- # displayName: Publish to local Maven for verification
75- # condition: not(contains(variables['build.sourceBranch'], 'refs/tags/v'))
72+ - script : ./gradlew --no-daemon publishToMavenLocal -PmavenCentralPublishingEnabled=true
73+ displayName : Publish to local Maven for verification
74+ condition : not(contains(variables['build.sourceBranch'], 'refs/tags/v'))
7675
7776 - script : ./gradlew --no-daemon publishMavenPublicationToADORepository -PmavenCentralPublishingEnabled=true -PmavenCentralSnapshotArtifactSuffix=""
7877 displayName : Publish to local Maven ADO for ESRP
79- # condition: contains(variables['build.sourceBranch'], 'refs/tags/v')
78+ condition : contains(variables['build.sourceBranch'], 'refs/tags/v')
8079
81- # - script: ./gradlew --no-daemon publishMavenPublicationToADORepository -PmavenCentralPublishingEnabled=true
82- # displayName: Publish to local Maven ADO for ESRP
83- # condition: not(contains(variables['build.sourceBranch'], 'refs/tags/v'))
80+ - script : ./gradlew --no-daemon publishMavenPublicationToADORepository -PmavenCentralPublishingEnabled=true
81+ displayName : Publish to local Maven ADO for ESRP
82+ condition : not(contains(variables['build.sourceBranch'], 'refs/tags/v'))
8483
8584 - pwsh : |
8685 $contents = Get-Content gradle.properties -Raw
87- $major = $contents | Select-String -Pattern 'mavenMajorVersion = ([0-9]+)' | ForEach-Object { $_.Matches.Groups[1].Value }
88- $minor = $contents | Select-String -Pattern 'mavenMinorVersion = ([0-9]+)' | ForEach-Object { $_.Matches.Groups[1].Value }
89- $patch = $contents | Select-String -Pattern 'mavenPatchVersion = ([0-9]+)' | ForEach-Object { $_.Matches.Groups[1].Value }
90- # $snapshot_suffix = if ($Env:BRANCH_NAME.StartsWith('refs/tags/v')) { '' } else { '-SNAPSHOT' }
86+ $major = $contents | Select-String -Pattern 'mavenMajorVersion\s*=\s* ([0-9]+)' | ForEach-Object { $_.Matches.Groups[1].Value }
87+ $minor = $contents | Select-String -Pattern 'mavenMinorVersion\s*=\s* ([0-9]+)' | ForEach-Object { $_.Matches.Groups[1].Value }
88+ $patch = $contents | Select-String -Pattern 'mavenPatchVersion\s*=\s* ([0-9]+)' | ForEach-Object { $_.Matches.Groups[1].Value }
89+ $snapshot_suffix = if ($Env:BRANCH_NAME.StartsWith('refs/tags/v')) { '' } else { '-SNAPSHOT' }
9190 $version = "$major.$minor.$patch$snapshot_suffix"
9291 echo "Current version is $version"
9392 echo "##vso[task.setvariable variable=PACKAGE_VERSION;]$version"
@@ -101,21 +100,19 @@ extends:
101100 displayName: Inspect contents of local Maven cache
102101
103102 - pwsh : |
104- .\scripts\zipPackageContent.ps1 -OutputDirectory $Env:OUTPUT_DIRECTORY -ArtifactId microsoft-graph-core -PackageSegment abstractions -Version $(PACKAGE_VERSION)
105- echo "list of zips:"
106- Get-ChildItem -Path $Env:OUTPUT_DIRECTORY -Filter "*.zip" | ForEach-Object { Write-Host $_.FullName }
107- displayName: Zip contents of local Maven cache
108- env:
109- OUTPUT_DIRECTORY: $(Build.ArtifactStagingDirectory)
103+ $packageFullPath = Join-Path -Path "./" -ChildPath "build/publishing-repository/com/microsoft/graph/microsoft-graph-core" -AdditionalChildPath "$(PACKAGE_VERSION)"
104+ echo "Package full path: $packageFullPath"
105+ echo "##vso[task.setvariable variable=PACKAGE_PATH;]$packageFullPath"
106+ displayName: Get the package full path
110107
111108 - task : 1ES.PublishPipelineArtifact@1
112109 displayName : " Publish Artifact: jars"
113110 inputs :
114111 artifactName : jars
115- targetPath : " $(Build.ArtifactStagingDirectory )"
112+ targetPath : " $(PACKAGE_PATH )"
116113
117114 - stage : deploy
118- # condition: and(or(contains(variables['build.sourceBranch'], 'refs/tags/v'), eq(variables['build.sourceBranch'], '${{ parameters.previewBranch }}')), succeeded())
115+ condition : and(or(contains(variables['build.sourceBranch'], 'refs/tags/v'), eq(variables['build.sourceBranch'], '${{ parameters.previewBranch }}')), succeeded())
119116 dependsOn : build
120117 jobs :
121118 - deployment : deploy_github
@@ -137,7 +134,7 @@ extends:
137134 deploy :
138135 steps :
139136 - pwsh : |
140- $zips = Get-ChildItem -Path "$(Pipeline.Workspace)" -Filter "*.zip "
137+ $zips = Get-ChildItem -Path "$(Pipeline.Workspace)" -Filter "*.jar "
141138 $zip = $zips | Select-Object -First 1
142139 $zipName = $zip.Name
143140 if ($zipName -match "\d+.\d+.\d+")
@@ -148,19 +145,10 @@ extends:
148145 }
149146 else
150147 {
151- Write-Error "No valid version found in zip file name."
148+ Write-Error "No valid version found in jar file name."
152149 exit 1
153150 }
154151
155- - pwsh : |
156- $zips = Get-ChildItem -Path "$(Pipeline.Workspace)" -Filter "*.zip"
157- foreach ($zip in $zips) {
158- $targetPath = $zip.FullName.Replace(".zip", "")
159- Expand-Archive -Path $zip.FullName -DestinationPath $targetPath
160- Remove-Item -Path $zip.FullName -Force
161- }
162- displayName: Unzip artifacts
163-
164152 - task : GitHubRelease@1
165153 inputs :
166154 gitHubConnection : " microsoftkiota"
@@ -204,7 +192,7 @@ extends:
204192
205193 - deployment : deploy_maven
206194 # snapshots are not supported by ESRP release for now, but they are planning to add support. When it happens, simply remove the condition
207- # condition: and(contains(variables['build.sourceBranch'], 'refs/tags/v'), succeeded())
195+ condition : and(contains(variables['build.sourceBranch'], 'refs/tags/v'), succeeded())
208196 pool :
209197 name : Azure-Pipelines-1ESPT-ExDShared
210198 os : linux
0 commit comments