diff --git a/.pipelines/PSResourceGet-Official.yml b/.pipelines/PSResourceGet-Official.yml index a44d53651..e4ea3ba1e 100644 --- a/.pipelines/PSResourceGet-Official.yml +++ b/.pipelines/PSResourceGet-Official.yml @@ -209,6 +209,8 @@ extends: type: windows steps: - checkout: self + env: + ob_restore_phase: true # Set ob_restore_phase to run this step before '🔒 Setup Signing' step. - pwsh: | if (-not (Test-Path $(repoRoot)/.config/tsaoptions.json)) { @@ -216,29 +218,48 @@ extends: throw "tsaoptions.json does not exist under $(repoRoot)/.config" } displayName: Test if tsaoptions.json exists + env: + ob_restore_phase: true # Set ob_restore_phase to run this step before '🔒 Setup Signing' step. - task: DownloadPipelineArtifact@2 displayName: 'Download build files' inputs: targetPath: $(signOutPath) artifact: drop_stagebuild_jobbuild + env: + ob_restore_phase: true # Set ob_restore_phase to run this step before '🔒 Setup Signing' step. - pwsh: | Set-Location "$(signOutPath)" Write-Host "Contents of signOutPath:" Get-ChildItem $(signOutPath) -Recurse displayName: Capture artifacts directory structure + env: + ob_restore_phase: true # Set ob_restore_phase to run this step before '🔒 Setup Signing' step. - pwsh: | # This need to be done before set-location so the module from PSHome is loaded Import-Module -Name Microsoft.PowerShell.PSResourceGet -Force Set-Location "$(signOutPath)\Microsoft.PowerShell.PSResourceGet" - $null = New-Item -ItemType Directory -Path "$(signOutPath)\PublishedNupkg" -Force + $publishPath = Join-Path $(signOutPath) -ChildPath 'PublishedNupkg' - Register-PSResourceRepository -Name 'localRepo' -Uri "$(signOutPath)\PublishedNupkg" + $null = New-Item -ItemType Directory -Path $publishPath -Force + + Register-PSResourceRepository -Name 'localRepo' -Uri $publishPath Publish-PSResource -Path "$(signOutPath)\Microsoft.PowerShell.PSResourceGet" -Repository 'localRepo' -Verbose + Write-Output "##vso[task.setvariable variable=publishPath]$publishPath" displayName: Create nupkg for publishing + env: + ob_restore_phase: true # Set ob_restore_phase to run this step before '🔒 Setup Signing' step. + + - pwsh: | + Set-Location '$(publishPath)' + Write-Host "Contents of signOutPath:" + Get-ChildItem '$(publishPath)' -Recurse + displayName: Find Nupkg Pre Signing + env: + ob_restore_phase: true # Set ob_restore_phase to run this step before '🔒 Setup Signing' step. - task: onebranch.pipeline.signing@1 displayName: Sign nupkg @@ -246,18 +267,18 @@ extends: command: 'sign' signing_profile: external_distribution files_to_sign: '**\*.nupkg' - search_root: "$(signOutPath)\PublishedNupkg" + search_root: '$(publishPath)' - pwsh: | - Set-Location "$(signOutPath)\PublishedNupkg" + Set-Location '$(publishPath)' Write-Host "Contents of signOutPath:" - Get-ChildItem "$(signOutPath)" -Recurse - displayName: Find Nupkg + Get-ChildItem '$(publishPath)' -Recurse + displayName: Find Nupkg Post Signing - task: CopyFiles@2 displayName: "Copy nupkg to ob_outputDirectory - '$(ob_outputDirectory)'" inputs: - Contents: $(signOutPath)\PublishedNupkg\Microsoft.PowerShell.PSResourceGet.*.nupkg + Contents: $(publishPath)\Microsoft.PowerShell.PSResourceGet.*.nupkg TargetFolder: $(ob_outputDirectory) - pwsh: |