@@ -2,6 +2,20 @@ name: PlatyPS-ModuleBuild-$(Build.BuildId)
2
2
trigger : none
3
3
pr : none
4
4
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
+
5
19
variables :
6
20
BuildConfiguration : Release
7
21
DOTNET_NOLOGO : true
@@ -79,8 +93,9 @@ extends:
79
93
signing_profile : external_distribution
80
94
search_root : $(Build.SourcesDirectory)/out/Microsoft.PowerShell.PlatyPS
81
95
files_to_sign : |
82
- *.psd1;
83
- *.ps1xml;
96
+ **/*.psm1;
97
+ **/*.psd1;
98
+ **/*.ps1xml;
84
99
Microsoft.PowerShell.*.dll;
85
100
- task : onebranch.pipeline.signing@1
86
101
displayName : Sign 3rd-party files
@@ -91,6 +106,10 @@ extends:
91
106
files_to_sign : |
92
107
Markdig.Signed.dll;
93
108
YamlDotNet.dll;
109
+ System.Buffers.dll
110
+ System.Memory.dll
111
+ System.Numerics.Vectors.dll
112
+ System.Runtime.CompilerServices.Unsafe.dll
94
113
- task : ArchiveFiles@2
95
114
displayName : Zip module
96
115
inputs :
@@ -118,8 +137,15 @@ extends:
118
137
includeRootFolder : false
119
138
archiveType : zip
120
139
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
121
146
- stage : release
122
147
dependsOn : build
148
+ condition : ${{ parameters.publishToPowerShellGallery }}
123
149
variables :
124
150
version : $[ stageDependencies.build.main.outputs['package.version'] ]
125
151
drop : $(Pipeline.Workspace)/drop_build_main
@@ -138,18 +164,38 @@ extends:
138
164
timeoutInMinutes : 1440
139
165
- job : publish
140
166
dependsOn : validation
167
+ templateContext :
168
+ inputs :
169
+ - input : pipelineArtifact
170
+ artifactName : drop_build_main
141
171
displayName : Publish to PowerShell Gallery
142
172
pool :
143
- type : windows
173
+ type : release
174
+ os : linux
144
175
variables :
145
176
ob_outputDirectory : $(Build.SourcesDirectory)/out/Microsoft.PowerShell.PlatyPS
146
177
steps :
147
178
- download : current
148
179
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}"
149
195
- task : NuGetCommand@2
150
- displayName : Publish ConsoleGuiTools to PowerShell Gallery
196
+ displayName : Push PlatyPS to PowerShell Gallery
151
197
inputs :
152
198
command : push
153
- packagesToPush : $(Build.SourcesDirectory)/Microsoft.PowerShell.PlatyPS.$(package.nupkgVersion).nupkg
199
+ packagesToPush : $(nupkgPath)
154
200
nuGetFeedType : external
155
- publishFeedCredentials : PowerShellGallery
201
+ publishFeedCredentials : PlatyPSGallery
0 commit comments