Skip to content

Commit 519eb7a

Browse files
authored
Add stage to publish Microsoft.PowerShell.PSResourceGet to ADO feed (#2058)
1 parent 655490a commit 519eb7a

1 file changed

Lines changed: 52 additions & 0 deletions

File tree

‎.pipelines/PSResourceGet-Official.yml‎

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ parameters: # parameters are shown up in ADO UI in a build queue time
1010
displayName: 'Enable debug output'
1111
type: boolean
1212
default: false
13+
- name: 'onlyPublishToCFSFeed'
14+
displayName: 'Only publish to ADO CFS feed (i.e excludes PSGallery)'
15+
type: boolean
16+
default: false
1317

1418
variables:
1519
- name: DOTNET_CLI_TELEMETRY_OPTOUT
@@ -18,6 +22,7 @@ variables:
1822
value: 1
1923
- name: WindowsContainerImage
2024
value: onebranch.azurecr.io/windows/ltsc2022/vse2022:latest # Docker image which is used to build the project https://aka.ms/obpipelines/containers
25+
- group: ArtifactFeedVariables
2126

2227
resources:
2328
repositories:
@@ -286,9 +291,56 @@ extends:
286291
Get-ChildItem "$(ob_outputDirectory)" -Recurse
287292
displayName: Find Signed Nupkg
288293
294+
- stage: releaseCFS
295+
displayName: 'Publish Package to CFS feed (msazure)'
296+
dependsOn: stagebuild
297+
jobs:
298+
- job: validation
299+
displayName: Publish to CFS feed
300+
variables:
301+
- name: ob_outputDirectory
302+
value: '$(Build.ArtifactStagingDirectory)/ONEBRANCH_ARTIFACT'
303+
- name: repoRoot
304+
value: $(Build.SourcesDirectory)\PSResourceGet
305+
- name: ob_sdl_tsa_configFile
306+
value: $(Build.SourcesDirectory)\PSResourceGet\.config\tsaoptions.json
307+
- name: signSrcPath
308+
value: $(repoRoot)/out
309+
- name: depsPath
310+
value: $(signSrcPath)\Microsoft.PowerShell.PSResourceGet\Dependencies
311+
- name: ob_sdl_sbom_enabled
312+
value: true
313+
- name: ob_signing_setup_enabled
314+
value: true
315+
#CodeQL tasks added manually to workaround signing failures
316+
- name: ob_sdl_codeql_compiled_enabled
317+
value: false
318+
pool:
319+
type: windows
320+
steps:
321+
- download: current
322+
artifact: 'drop_stagebuild_nupkg'
323+
- task: NuGetAuthenticate@1
324+
displayName: 'Authenticate to external Azure Artifacts feed'
325+
inputs:
326+
azureDevOpsServiceConnection: 'PSGetPushToMsAzureFeed'
327+
feedUrl: 'https://msazure.pkgs.visualstudio.com/One/_packaging/pwsh-deployment-module-feed/nuget/v3/index.json'
328+
- pwsh: |
329+
$publishNupkg = Get-ChildItem -Path '$(Pipeline.Workspace)\drop_stagebuild_nupkg\PSResourceGet\signed\PublishedNupkg\Microsoft.PowerShell.PSResourceGet.*.nupkg' -Recurse -File | Select-Object -First 1
330+
if (-not $publishNupkg)
331+
{
332+
throw "No nupkg found under $(Pipeline.Workspace) matching Microsoft.PowerShell.PSResourceGet.*.nupkg"
333+
}
334+
$publishNupkgPath = $publishNupkg.FullName
335+
Write-Verbose -Verbose "Package found at path: $publishNupkgPath"
336+
$adoRepoUri = "https://msazure.pkgs.visualstudio.com/One/_packaging/pwsh-deployment-module-feed/nuget/v3/index.json"
337+
dotnet nuget push $publishNupkgPath --source $adoRepoUri --api-key az --skip-duplicate
338+
displayName: 'Push package to external Azure Artifacts feed'
339+
289340
- stage: release
290341
displayName: Release PSResourceGet
291342
dependsOn: stagebuild
343+
condition: and(succeeded(), not(${{ parameters.onlyPublishToCFSFeed }}))
292344
variables:
293345
version: $[ stageDependencies.build.main.outputs['package.version'] ]
294346
drop: $(Pipeline.Workspace)/drop_stagebuild_nupkg

0 commit comments

Comments
 (0)