@@ -43,7 +43,6 @@ extends:
43
43
# TODO maybe missing template context with sdl baselines?
44
44
steps :
45
45
- checkout : self
46
- persistCredentials : true
47
46
48
47
- task : JavaToolInstaller@1
49
48
inputs :
@@ -68,54 +67,52 @@ extends:
68
67
69
68
- script : ./gradlew --no-daemon publishToMavenLocal -PmavenCentralPublishingEnabled=true -PmavenCentralSnapshotArtifactSuffix=""
70
69
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')
72
71
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'))
76
75
77
76
- script : ./gradlew --no-daemon publishMavenPublicationToADORepository -PmavenCentralPublishingEnabled=true -PmavenCentralSnapshotArtifactSuffix=""
78
77
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')
80
79
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'))
84
83
85
84
- pwsh : |
86
85
$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' }
91
90
$version = "$major.$minor.$patch$snapshot_suffix"
92
91
echo "Current version is $version"
93
92
echo "##vso[task.setvariable variable=PACKAGE_VERSION;]$version"
94
93
displayName: Get current version
95
94
name: GetVersion
96
95
env:
97
- BRANCH_NAME: $(Build.SourceBranchName )
96
+ BRANCH_NAME: $(Build.SourceBranch )
98
97
99
98
- pwsh : |
100
99
.\scripts\validatePackageContents.ps1 -ArtifactId microsoft-graph -Version $(PACKAGE_VERSION) -ValidateMavenMetadata $false
101
100
displayName: Inspect contents of local Maven cache
102
101
103
102
- pwsh : |
104
- .\scripts\zipPackageContent.ps1 -OutputDirectory $Env:OUTPUT_DIRECTORY -ArtifactId microsoft-graph -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" -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
110
107
111
108
- task : 1ES.PublishPipelineArtifact@1
112
109
displayName : " Publish Artifact: jars"
113
110
inputs :
114
111
artifactName : jars
115
- targetPath : " $(Build.ArtifactStagingDirectory )"
112
+ targetPath : " $(PACKAGE_PATH )"
116
113
117
114
- 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())
119
116
dependsOn : build
120
117
jobs :
121
118
- deployment : deploy_github
@@ -137,7 +134,7 @@ extends:
137
134
deploy :
138
135
steps :
139
136
- pwsh : |
140
- $zips = Get-ChildItem -Path "$(Pipeline.Workspace)" -Filter "*.zip "
137
+ $zips = Get-ChildItem -Path "$(Pipeline.Workspace)" -Filter "*.jar "
141
138
$zip = $zips | Select-Object -First 1
142
139
$zipName = $zip.Name
143
140
if ($zipName -match "\d+.\d+.\d+")
@@ -148,18 +145,9 @@ extends:
148
145
}
149
146
else
150
147
{
151
- Write-Error "No valid version found in zip file name."
148
+ Write-Error "No valid version found in jar file name."
152
149
exit 1
153
150
}
154
-
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
151
164
152
- task : GitHubRelease@1
165
153
inputs :
@@ -204,7 +192,7 @@ extends:
204
192
205
193
- deployment : deploy_maven
206
194
# 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())
208
196
pool :
209
197
name : Azure-Pipelines-1ESPT-ExDShared
210
198
os : linux
0 commit comments