Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 7 additions & 28 deletions .pipelines/PSResourceGet-Official.yml
Original file line number Diff line number Diff line change
Expand Up @@ -209,76 +209,55 @@ 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)) {
Get-ChildItem $(Build.SourcesDirectory) -recurse -ErrorAction SilentlyContinue
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"
$publishPath = Join-Path $(signOutPath) -ChildPath 'PublishedNupkg'
$null = New-Item -ItemType Directory -Path "$(signOutPath)\PublishedNupkg" -Force

$null = New-Item -ItemType Directory -Path $publishPath -Force

Register-PSResourceRepository -Name 'localRepo' -Uri $publishPath
Register-PSResourceRepository -Name 'localRepo' -Uri "$(signOutPath)\PublishedNupkg"
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
inputs:
command: 'sign'
signing_profile: external_distribution
files_to_sign: '**\*.nupkg'
search_root: '$(publishPath)'
search_root: "$(signOutPath)\PublishedNupkg"

- pwsh: |
Set-Location '$(publishPath)'
Set-Location "$(signOutPath)\PublishedNupkg"
Write-Host "Contents of signOutPath:"
Get-ChildItem '$(publishPath)' -Recurse
displayName: Find Nupkg Post Signing
Get-ChildItem "$(signOutPath)" -Recurse
displayName: Find Nupkg

- task: CopyFiles@2
displayName: "Copy nupkg to ob_outputDirectory - '$(ob_outputDirectory)'"
inputs:
Contents: $(publishPath)\Microsoft.PowerShell.PSResourceGet.*.nupkg
Contents: $(signOutPath)\PublishedNupkg\Microsoft.PowerShell.PSResourceGet.*.nupkg
TargetFolder: $(ob_outputDirectory)

- pwsh: |
Expand Down
Loading