@@ -2,6 +2,20 @@ name: PlatyPS-ModuleBuild-$(Build.BuildId)
22trigger : none
33pr : none
44
5+ schedules :
6+ - cron : ' 0 3 * * 1'
7+ displayName : Weekly Build
8+ branches :
9+ include :
10+ - v2
11+ always : true
12+
13+ parameters :
14+ - name : ' publishToPowerShellGallery'
15+ displayName : ' Publish module to PowerShell gallery'
16+ type : boolean
17+ default : false
18+
519variables :
620 BuildConfiguration : Release
721 DOTNET_NOLOGO : true
@@ -79,8 +93,9 @@ extends:
7993 signing_profile : external_distribution
8094 search_root : $(Build.SourcesDirectory)/out/Microsoft.PowerShell.PlatyPS
8195 files_to_sign : |
82- *.psd1;
83- *.ps1xml;
96+ **/*.psm1;
97+ **/*.psd1;
98+ **/*.ps1xml;
8499 Microsoft.PowerShell.*.dll;
85100 - task : onebranch.pipeline.signing@1
86101 displayName : Sign 3rd-party files
@@ -91,6 +106,10 @@ extends:
91106 files_to_sign : |
92107 Markdig.Signed.dll;
93108 YamlDotNet.dll;
109+ System.Buffers.dll
110+ System.Memory.dll
111+ System.Numerics.Vectors.dll
112+ System.Runtime.CompilerServices.Unsafe.dll
94113 - task : ArchiveFiles@2
95114 displayName : Zip module
96115 inputs :
@@ -118,8 +137,15 @@ extends:
118137 includeRootFolder : false
119138 archiveType : zip
120139 archiveFile : out/Microsoft.PowerShell.PlatyPS.nupkg.zip
140+ - pwsh : |
141+ Write-Verbose -Verbose -Message "Validating nupkg exists"
142+ $nupkgPath = "$(Build.SourcesDirectory)/Microsoft.PowerShell.PlatyPS.$(package.nupkgVersion).nupkg"
143+ $exists = Test-Path $nupkgPath
144+ Write-Verbose -Verbose -Message "'$nupkgPath' exists: $exists"
145+ displayName: Validate nupkg existence
121146 - stage : release
122147 dependsOn : build
148+ condition : ${{ parameters.publishToPowerShellGallery }}
123149 variables :
124150 version : $[ stageDependencies.build.main.outputs['package.version'] ]
125151 drop : $(Pipeline.Workspace)/drop_build_main
@@ -138,18 +164,38 @@ extends:
138164 timeoutInMinutes : 1440
139165 - job : publish
140166 dependsOn : validation
167+ templateContext :
168+ inputs :
169+ - input : pipelineArtifact
170+ artifactName : drop_build_main
141171 displayName : Publish to PowerShell Gallery
142172 pool :
143- type : windows
173+ type : release
174+ os : linux
144175 variables :
145176 ob_outputDirectory : $(Build.SourcesDirectory)/out/Microsoft.PowerShell.PlatyPS
146177 steps :
147178 - download : current
148179 displayName : Download artifacts
180+ - task : powershell@2
181+ inputs :
182+ pwsh : true
183+ targetType : inline
184+ script : |
185+ $artifactPath = "$(Pipeline.Workspace)"
186+ $zipItem = Get-ChildItem -Path $artifactPath -Recurse -Filter "*.nupkg.zip" | Where-Object { $_.Name -like "Microsoft.PowerShell.PlatyPS.*.nupkg.zip" } | Select-Object -First 1
187+ Expand-Archive -Path $nupkgItem.FullName -DestinationPath $artifactPath
188+ $nupkgItem = Get-ChildItem -Path $artifactPath -Recurse -Filter "*.nupkg" | Where-Object { $_.Name -like "Microsoft.PowerShell.PlatyPS.*.nupkg" } | Select-Object -First 1
189+ if (-not $nupkgItem) {
190+ Write-Error "No nupkg found in '$artifactPath'"
191+ exit 1
192+ }
193+ $nupkgPath = $nupkgItem.FullName
194+ Write-Output "##vso[task.setvariable variable=nupkgPath;isOutput=true]${nupkgPath}"
149195 - task : NuGetCommand@2
150- displayName : Publish ConsoleGuiTools to PowerShell Gallery
196+ displayName : Push PlatyPS to PowerShell Gallery
151197 inputs :
152198 command : push
153- packagesToPush : $(Build.SourcesDirectory)/Microsoft.PowerShell.PlatyPS.$(package.nupkgVersion).nupkg
199+ packagesToPush : $(nupkgPath)
154200 nuGetFeedType : external
155- publishFeedCredentials : PowerShellGallery
201+ publishFeedCredentials : PlatyPSGallery
0 commit comments