Skip to content

Commit a32af99

Browse files
authored
Merge pull request #24 from alerickson/releaseYaml
2 parents aa5cfde + 45a71ca commit a32af99

File tree

1 file changed

+55
-6
lines changed

1 file changed

+55
-6
lines changed

.ci/releaseBuild.yml

Lines changed: 55 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,27 @@ stages:
9797
**\*.psm1
9898
useMinimatch: true
9999

100-
# finally publish the parts of the build which will be used in the next stages
101-
# if it's not published, the subsequent stages will not be able to access it.
102-
- publish: "$(Build.SourcesDirectory)/OSS_Microsoft_CompatPowerShellGet"
103-
artifact: build
104-
displayName: publish build directory
100+
# Register local folder as PSRepository
101+
# Then publish-module to that folder
102+
- pwsh: |
103+
$localRepo = "$(Build.SourcesDirectory)/local"
104+
New-Item -Path $localRepo -ItemType Directory -Force
105+
$vstsCommandString = "vso[task.setvariable variable=localRepo]${localRepo}"
106+
Write-Host "local repo is: " + $vstsCommandString
107+
Write-Host "##$vstsCommandString"
108+
109+
Register-PSRepository -Name local -SourceLocation $(localRepo)
110+
Publish-Module -Path $(signOutPath) -Repository local
111+
displayName: Publish module to local repository
112+
113+
- pwsh: |
114+
$nupkgPath = "$(localRepo)"
115+
$artifactName = "CompatPowerShellGet"
116+
Write-Host "##vso[artifact.upload containerfolder=$artifactName;artifactname=$artifactName;]$nupkgPath"
117+
displayName: Upload module artifact
105118
106119
# Now on to the compliance stage
107-
- stage: compliance
120+
- stage: Compliance
108121
displayName: Compliance
109122
dependsOn: Build
110123
jobs:
@@ -133,3 +146,39 @@ stages:
133146
codeBaseName: 'CompatPowerShellGet_20200201'
134147
# selections
135148
APIScan: false # set to false when not using Windows APIs.
149+
150+
stages:
151+
- stage: Publish
152+
displayName: Publish
153+
dependsOn: Compliance
154+
pool:
155+
name: 1ES
156+
demands:
157+
- ImageOverride -equals PSMMS2019-Secure
158+
jobs:
159+
- job: Publish_Job
160+
displayName: Build Microsoft.PowerShell.CompatPowerShellGet
161+
steps:
162+
- checkout: self
163+
164+
- task: DownloadPipelineArtifact@2
165+
displayName: 'Download PowerShellGet module artifacts'
166+
inputs:
167+
artifact: CompatPowerShellGet
168+
patterns: '**/*.nupkg'
169+
downloadPath: '$(Pipeline.Workspace)/nuget'
170+
171+
- pwsh: |
172+
$package = (Get-ChildItem '$(Pipeline.Workspace)/nuget/CompatPowerShellGet.*.nupkg').FullName
173+
$vstsCommandString = "vso[task.setvariable variable=NugetPkgPath]${package}"
174+
Write-Host "sending " + $vstsCommandString
175+
Write-Host "##$vstsCommandString"
176+
displayName: 'Capture PowerShellGet module NuGet package path and set environment variable'
177+
178+
- task: NuGetCommand@2
179+
displayName: 'Push CompatPowerShellGet module artifacts to PSGallery feed'
180+
inputs:
181+
command: push
182+
packagesToPush: '$(NugetPkgPath)'
183+
nuGetFeedType: external
184+
publishFeedCredentials: PSGalleryPush

0 commit comments

Comments
 (0)