Skip to content

Commit 1f751c0

Browse files
authored
Add deploybox to OneBranch build for publishing to gallery (#707)
* alternative approach * Add debugging output to see what's happening. * Location for zip file is known. Leave some debugging, but expand the archive where it should be and then set the variable to the path of the nupkg. * Yet another try to get the publish right. * Fix typo in line 187 * Fix typo in line 192 * change type from windows to release. * More changes for deploybox. * Yet another try to get the publish right. * more deploybox changes. * Remove use of pwsh, it will default to powershell.
1 parent a186c87 commit 1f751c0

File tree

1 file changed

+18
-26
lines changed

1 file changed

+18
-26
lines changed

.pipelines/PlatyPS-Official.yml

Lines changed: 18 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ extends:
3636
# https://aka.ms/obpipelines/templates
3737
template: v2/OneBranch.Official.CrossPlat.yml@templates
3838
parameters:
39+
release:
40+
category: NonAzure
3941
featureFlags:
4042
WindowsHostVersion: '1ESWindows2022'
4143
globalSdl: # https://aka.ms/obpipelines/sdl
@@ -143,55 +145,45 @@ extends:
143145
$exists = Test-Path $nupkgPath
144146
Write-Verbose -Verbose -Message "'$nupkgPath' exists: $exists"
145147
displayName: Validate nupkg existence
146-
- stage: release
148+
- stage: Prod_release_official_platyps
147149
dependsOn: build
148150
condition: ${{ parameters.publishToPowerShellGallery }}
149151
variables:
150152
version: $[ stageDependencies.build.main.outputs['package.version'] ]
151153
drop: $(Pipeline.Workspace)/drop_build_main
154+
ob_release_environment: Production
152155
jobs:
153-
- job: validation
154-
displayName: Manual validation
155-
pool:
156-
type: agentless
157-
timeoutInMinutes: 1440
158-
steps:
159-
- task: ManualValidation@0
160-
displayName: Wait 24 hours for validation
161-
inputs:
162-
notifyUsers: $(Build.RequestedForEmail)
163-
instructions: Please validate the release and then publish it!
164-
timeoutInMinutes: 1440
165-
- job: publish
166-
dependsOn: validation
156+
- job: ReleaseJob
167157
templateContext:
168158
inputs:
169159
- input: pipelineArtifact
170160
artifactName: drop_build_main
171161
displayName: Publish to PowerShell Gallery
172162
pool:
173163
type: release
174-
os: linux
164+
os: windows
175165
variables:
176166
ob_outputDirectory: $(Build.SourcesDirectory)/out/Microsoft.PowerShell.PlatyPS
177167
steps:
178-
- download: current
179-
displayName: Download artifacts
180168
- task: powershell@2
181169
inputs:
182-
pwsh: true
183170
targetType: inline
184171
script: |
185-
$artifactPath = "$(Pipeline.Workspace)"
186-
$zipItem = Get-ChildItem -Path $artifactPath -Recurse -Filter "*.nupkg.zip" | Where-Object { $_.Name -like "Microsoft.PowerShell.PlatyPS.*.nupkg.zip" } | Select-Object -First 1
187-
Expand-Archive -Path $nupkgItem.FullName -DestinationPath $artifactPath
188-
$nupkgItem = Get-ChildItem -Path $artifactPath -Recurse -Filter "*.nupkg" | Where-Object { $_.Name -like "Microsoft.PowerShell.PlatyPS.*.nupkg" } | Select-Object -First 1
172+
$zipFile = "$(drop)/Microsoft.PowerShell.PlatyPS.nupkg.zip"
173+
$zipExists = Test-Path $zipFile
174+
if (-not $zipExists) {
175+
Get-ChildItem -Recurse $(pipeline.Workspace) | %{ Write-Verbose -Verbose -Message $_.FullName }
176+
throw "'$zipFile' does not exist!"
177+
}
178+
Write-Verbose -Verbose -Message ("exists: $zipFile " + (Test-Path $zipFile))
179+
Expand-Archive -Path $zipFile -DestinationPath $(drop)
180+
$nupkgItem = Get-ChildItem -Path $(drop) -Filter "Microsoft.PowerShell.PlatyPS.*.nupkg" |
181+
Select-Object -First 1
189182
if (-not $nupkgItem) {
190-
Write-Error "No nupkg found in '$artifactPath'"
191-
exit 1
183+
throw "No nupkg found in '$(drop)'"
192184
}
193185
$nupkgPath = $nupkgItem.FullName
194-
Write-Output "##vso[task.setvariable variable=nupkgPath;isOutput=true]${nupkgPath}"
186+
Write-Output "##vso[task.setvariable variable=nupkgPath]${nupkgPath}"
195187
- task: NuGetCommand@2
196188
displayName: Push PlatyPS to PowerShell Gallery
197189
inputs:

0 commit comments

Comments
 (0)