@@ -31,6 +31,7 @@ Enum AssetType {
3131 ApplicationBundle
3232 PreinstallKit
3333 GroupPolicy
34+ NugetPackage
3435 Zip
3536}
3637
@@ -87,6 +88,9 @@ Class Asset {
8788 } ElseIf (" .zip" -eq $local :ext -and $local :filename -like ' GroupPolicy*' ) {
8889 $this.Type = [AssetType ]::GroupPolicy
8990 $this.Architecture = " all"
91+ } ElseIf (" .nupkg" -eq $local :ext ) {
92+ $this.Type = [AssetType ]::NugetPackage
93+ $this.Architecture = " all"
9094 } ElseIf (" .zip" -eq $local :ext ) {
9195 $this.Type = [AssetType ]::Zip
9296 } ElseIf (" .msixbundle" -eq $local :ext ) {
@@ -108,6 +112,13 @@ Class Asset {
108112 Write-Verbose " Parsing AppxManifest.xml"
109113 $local :Manifest = [xml ](Get-Content (Join-Path $local :directory AppxManifest.xml))
110114 $this.ParseManifest ($local :Manifest )
115+ } ElseIf ($this.Type -Eq [AssetType ]::NugetPackage) {
116+ Write-Verbose " Cracking nuget package $ ( $local :filename ) "
117+ & $script :tar - x -f $local :bundlePath - C $local :directory * .nuspec
118+ $local :nuspec = Get-ChildItem $local :directory * .nuspec - Recurse | Select-Object - First 1
119+ Write-Verbose " Parsing $ ( $local :nuspec.Name ) "
120+ $local :Manifest = [xml ](Get-Content $local :nuspec )
121+ $this.ParseNuspec ($local :Manifest )
111122 } Else {
112123 If ($this.Type -Ne [AssetType ]::GroupPolicy) {
113124 & $script :tar - x -f $this.Path - C $local :directory -- strip- components= 1 ' */wt.exe'
@@ -135,6 +146,12 @@ Class Asset {
135146 $this.Version = $Manifest.Package.Identity.Version
136147 }
137148
149+ [void ]ParseNuspec([xml ]$Nuspec ) {
150+ $this.Name = $Nuspec.package.metadata.id
151+ $this.Version = ($Nuspec.package.metadata.version -split ' -' )[0 ]
152+ $this.ExpandedVersion = $Nuspec.package.metadata.version
153+ }
154+
138155 [void ]ParseFilename([string ]$filename ) {
139156 $parts = [IO.Path ]::GetFileNameWithoutExtension($filename ).Split(" _" )
140157 $this.Name = $parts [0 ]
@@ -160,6 +177,9 @@ Class Asset {
160177 GroupPolicy {
161178 " {0}_{1}.zip" -f ($this.Name , $this.Version )
162179 }
180+ NugetPackage {
181+ " {0}.{1}.nupkg" -f ($this.Name , $this.ExpandedVersion )
182+ }
163183 Default {
164184 Throw " Unknown type $ ( $_.Type ) "
165185 }
@@ -253,15 +273,11 @@ Function New-ReleaseBody([Release]$Release) {
253273 If (-Not [String ]::IsNullOrEmpty($zipAssetVersion )) {
254274 $body += " _Binary files inside the unpackaged distribution archive bear the version number `` $zipAssetVersion `` ._`n`n "
255275 }
256- $body += " ### Asset Hashes`n`n " ;
257- ForEach ($a in $Release.Assets ) {
258- $body += " - {0}`n - SHA256 `` {1}```n " -f ($a.IdealFilename (), (Get-FileHash $a.Path - Algorithm SHA256 | Select-Object - Expand Hash))
259- }
260276 Return $body
261277}
262278
263279# Collect Assets from $Directory, figure out what those assets are
264- $Assets = Get-ChildItem $Directory - Recurse - Include * .msixbundle, * .zip | ForEach-Object {
280+ $Assets = Get-ChildItem $Directory - Recurse - Include * .msixbundle, * .zip, * .nupkg - Exclude * .Wpf. * , * .symbols.nupkg | ForEach-Object {
265281 [Asset ]::CreateFromFile($_.FullName )
266282}
267283
0 commit comments