Skip to content
Open
Show file tree
Hide file tree
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
59 changes: 59 additions & 0 deletions .pipelines/templates/release-Nuget.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
parameters:
- name: skipPublish
type: boolean

jobs:
- job: NuGetPublish
displayName: Publish to NuGet
condition: succeeded()
pool:
type: release
os: windows
templateContext:
inputs:
- input: pipelineArtifact
pipeline: PSPackagesOfficial
artifactName: drop_upload_upload_packages
variables:
- template: ./variables/release-shared.yml@self
parameters:
VERSION: $[ stageDependencies.setReleaseTagAndChangelog.setTagAndChangelog.outputs['OutputVersion.Version'] ]

steps:
- task: PowerShell@2
inputs:
targetType: inline
script: |
Write-Verbose -Verbose "Version: $(Version)"
Get-ChildItem Env: | Out-String -width 9999 -Stream | write-Verbose -Verbose
displayName: 'Capture Environment Variables'

- task: PowerShell@2
inputs:
targetType: inline
script: |
#Exclude all global tool packages. Their names start with 'PowerShell.'
$null = New-Item -ItemType Directory -Path "$(Pipeline.Workspace)/release"
Copy-Item "$(Pipeline.Workspace)/NuGetPackages/*.nupkg" -Destination "$(Pipeline.Workspace)/release" -Exclude "PowerShell.*.nupkg" -Force -Verbose

$releaseVersion = '$(Version)'
$globalToolPath = "$(Pipeline.Workspace)/NuGetPackages/PowerShell.$releaseVersion.nupkg"

if ($releaseVersion -notlike '*-*') {
# Copy the global tool package for stable releases
Copy-Item $globalToolPath -Destination "$(Pipeline.Workspace)/release"
}

Write-Verbose -Verbose "The .nupkgs below will be pushed:"
Get-ChildItem "$(Pipeline.Workspace)/release" -recurse
displayName: Download and capture nupkgs
condition: and(ne('${{ parameters.skipPublish }}', 'true'), succeeded())

- task: NuGetCommand@2
displayName: 'NuGet push'
condition: and(ne('${{ parameters.skipPublish }}', 'true'), succeeded())
inputs:
command: push
packagesToPush: '$(Pipeline.Workspace)/release/*.nupkg'
nuGetFeedType: external
publishFeedCredentials: PowerShellNuGetOrgPush
Original file line number Diff line number Diff line change
Expand Up @@ -171,58 +171,3 @@ jobs:
action: 'create'
releaseNotesFilePath: '$(ReleaseNotesFilePath)'
isPrerelease: '$(IsPreRelease)'

- job: NuGetPublish
displayName: Publish to NuGet
condition: succeeded()
pool:
type: release
os: windows
templateContext:
inputs:
- input: pipelineArtifact
pipeline: PSPackagesOfficial
artifactName: drop_upload_upload_packages
variables:
- template: ./variables/release-shared.yml@self
parameters:
VERSION: $[ stageDependencies.setReleaseTagAndChangelog.SetTagAndChangelog.outputs['OutputVersion.Version'] ]

steps:
- task: PowerShell@2
inputs:
targetType: inline
script: |
Write-Verbose -Verbose "Version: $(Version)"
Get-ChildItem Env: | Out-String -width 9999 -Stream | write-Verbose -Verbose
displayName: 'Capture Environment Variables'

- task: PowerShell@2
inputs:
targetType: inline
script: |
#Exclude all global tool packages. Their names start with 'PowerShell.'
$null = New-Item -ItemType Directory -Path "$(Pipeline.Workspace)/release"
Copy-Item "$(Pipeline.Workspace)/NuGetPackages/*.nupkg" -Destination "$(Pipeline.Workspace)/release" -Exclude "PowerShell.*.nupkg" -Force -Verbose

$releaseVersion = '$(Version)'
$globalToolPath = "$(Pipeline.Workspace)/NuGetPackages/PowerShell.$releaseVersion.nupkg"

if ($releaseVersion -notlike '*-*') {
# Copy the global tool package for stable releases
Copy-Item $globalToolPath -Destination "$(Pipeline.Workspace)/release"
}

Write-Verbose -Verbose "The .nupkgs below will be pushed:"
Get-ChildItem "$(Pipeline.Workspace)/release" -recurse
displayName: Download and capture nupkgs
condition: and(ne('${{ parameters.skipPublish }}', 'true'), succeeded())

- task: NuGetCommand@2
displayName: 'NuGet push'
condition: and(ne('${{ parameters.skipPublish }}', 'true'), succeeded())
inputs:
command: push
packagesToPush: '$(Pipeline.Workspace)/release/*.nupkg'
nuGetFeedType: external
publishFeedCredentials: PowerShellNuGetOrgPush
28 changes: 17 additions & 11 deletions .pipelines/templates/stages/PowerShell-Release-Stages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,6 @@ stages:
dependsOn: []
displayName: Manual Validation
jobs:
- template: /.pipelines/templates/approvalJob.yml@self
parameters:
displayName: Validate Windows Packages
jobName: ValidateWinPkg
instructions: |
Validate zip package on windows
- template: /.pipelines/templates/approvalJob.yml@self
parameters:
displayName: Validate OSX Packages
Expand Down Expand Up @@ -159,21 +152,21 @@ stages:
Update and merge the changelog for the release.
This step is required for creating GitHub draft release.
- stage: PublishGitHubReleaseAndNuget
displayName: Publish GitHub and Nuget Release
- stage: PublishGitHubRelease
displayName: Publish GitHub
dependsOn:
- setReleaseTagAndChangelog
- UpdateChangeLog
variables:
ob_release_environment: ${{ parameters.releaseEnvironment }}
jobs:
- template: /.pipelines/templates/release-githubNuget.yml@self
- template: /.pipelines/templates/release-github.yml@self
parameters:
skipPublish: ${{ parameters.SkipPublish }}

- stage: PushGitTagAndMakeDraftPublic
displayName: Push Git Tag and Make Draft Public
dependsOn: PublishGitHubReleaseAndNuget
dependsOn: PublishGitHubRelease
jobs:
- template: /.pipelines/templates/approvalJob.yml@self
parameters:
Expand All @@ -190,6 +183,19 @@ stages:
instructions: |
Make the GitHub Release Draft Public
- stage: PublishNugetRelease
displayName: Publish Nuget Release
dependsOn:
- setReleaseTagAndChangelog
- PushGitTagAndMakeDraftPublic
- UpdateChangeLog
variables:
ob_release_environment: ${{ parameters.releaseEnvironment }}
jobs:
- template: /.pipelines/templates/release-Nuget.yml@self
parameters:
skipPublish: ${{ parameters.SkipPublish }}

- stage: BlobPublic
displayName: Make Blob Public
dependsOn:
Expand Down
Loading