Skip to content

Commit 677c086

Browse files
Fix APIScan by providing the required parameters (#66)
1 parent 392e5b5 commit 677c086

File tree

3 files changed

+48
-28
lines changed

3 files changed

+48
-28
lines changed

tools/releaseBuild/yaml/nuget.yml

+3-28
Original file line numberDiff line numberDiff line change
@@ -65,32 +65,7 @@ steps:
6565
inputs:
6666
versionSpec: 5.3.1
6767

68-
- powershell: |
69-
$Branch = $env:BUILD_SOURCEBRANCH
70-
$branchOnly = $Branch -replace '^refs/heads/';
71-
$branchOnly = $branchOnly -replace '[_\-]'
72-
73-
$packageVersion = if($env:PACKAGE_VERSION -eq 'fromBranch' -or !$env:PACKAGE_VERSION)
74-
{
75-
if($Branch -match '^.*(release[-/])')
76-
{
77-
Write-verbose "release branch:" -verbose
78-
$Branch -replace '^.*(release[-/]v)'
79-
}
80-
else
81-
{
82-
"0.0.0"
83-
}
84-
}
85-
else {
86-
"0.0.0"
87-
}
88-
89-
$vstsCommandString = "vso[task.setvariable variable=NugetPackageVersion]$packageVersion"
90-
Write-Verbose -Message "setting $Variable to $packageVersion" -Verbose
91-
Write-Host -Object "##$vstsCommandString"
92-
93-
displayName: Set NuGetPackageVersion
68+
- template: setVersion.yml
9469

9570
- powershell: |
9671
Import-Module $(Build.SourcesDirectory)\build.psm1
@@ -107,7 +82,7 @@ steps:
10782
$macOSZipPath = Join-Path "$(System.ArtifactsDirectory)/release" 'osx-symbols.zip'
10883
$psrpZipPath = Join-Path "$(System.ArtifactsDirectory)/release" 'psrp.zip'
10984
110-
Start-BuildPowerShellNativePackage -PackageRoot $PackageRoot -Version $(NugetPackageVersion) -WindowsX64ZipPath $WindowsX64ZipPath -WindowsX86ZipPath $WindowsX86ZipPath -WindowsARMZipPath $WindowsARMZipPath -WindowsARM64ZipPath $WindowsARM64ZipPath -LinuxZipPath $LinuxZipPath -LinuxARMZipPath $LinuxARMZipPath -LinuxARM64ZipPath $LinuxARM64ZipPath -LinuxAlpineZipPath $LinuxAlpineZipPath -macOSZipPath $macOSZipPath -psrpZipPath $psrpZipPath -NuGetOutputPath $(NuGetPackagePath)
85+
Start-BuildPowerShellNativePackage -PackageRoot $PackageRoot -Version $(PackageVersion) -WindowsX64ZipPath $WindowsX64ZipPath -WindowsX86ZipPath $WindowsX86ZipPath -WindowsARMZipPath $WindowsARMZipPath -WindowsARM64ZipPath $WindowsARM64ZipPath -LinuxZipPath $LinuxZipPath -LinuxARMZipPath $LinuxARMZipPath -LinuxARM64ZipPath $LinuxARM64ZipPath -LinuxAlpineZipPath $LinuxAlpineZipPath -macOSZipPath $macOSZipPath -psrpZipPath $psrpZipPath -NuGetOutputPath $(NuGetPackagePath)
11186
11287
displayName: 'Build NuGet package'
11388

@@ -152,5 +127,5 @@ steps:
152127
- template: uploadArtifact.yml
153128
parameters:
154129
artifactPath: '$(System.ArtifactsDirectory)\signed'
155-
artifactFilter: 'Microsoft.PowerShell.Native.$(NugetPackageVersion).nupkg'
130+
artifactFilter: 'Microsoft.PowerShell.Native.$(PackageVersion).nupkg'
156131
artifactName: 'finalResults'

tools/releaseBuild/yaml/releaseBuild.yml

+13
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,12 @@ stages:
110110
- download: current
111111
artifact: signed
112112

113+
- template: setVersion.yml
114+
115+
- pwsh: |
116+
Get-ChildItem -Path 'ENV:'
117+
displayName: Capture environment
118+
113119
- powershell: |
114120
$null = New-Item $(PackageRoot) -ItemType Directory -Force -Verbose
115121
if(-not (Test-Path '$(Pipeline.Workspace)/release' ))
@@ -138,6 +144,10 @@ stages:
138144
Get-ChildItem -Recurse $extractedRoot -File
139145
displayName: 'Extract All Zips'
140146
147+
- pwsh: |
148+
Write-Verbose -Verbose "$(PackageVersion)"
149+
displayName: 'Write the package version'
150+
141151
- template: assembly-module-compliance.yml@ComplianceRepo
142152
parameters:
143153
# binskim
@@ -153,6 +163,9 @@ stages:
153163
# tsa-upload
154164
codeBaseName: 'PowerShellNative'
155165
# selections
166+
softwareName: 'PowerShellNative'
167+
softwareNameFolder: '$(Pipeline.Workspace)/uncompressed'
168+
softwareVersion: '$(PackageVersion)'
156169
APIScan: true # set to false when not using Windows APIs.
157170

158171
- template: publish.yml
+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
steps:
2+
- pwsh: |
3+
$Branch = $env:BUILD_SOURCEBRANCH
4+
$branchOnly = $Branch -replace '^refs/heads/';
5+
$branchOnly = $branchOnly -replace '[_\-]'
6+
7+
Write-Verbose -Verbose "Branch == $Branch"
8+
Write-Verbose -Verbose "BranchOnly == $branchOnly"
9+
10+
$packageVersion = if($env:PACKAGE_VERSION -eq 'fromBranch' -or !$env:PACKAGE_VERSION)
11+
{
12+
if($Branch -match '^.*(release[-/])')
13+
{
14+
Write-verbose "release branch:" -verbose
15+
$Branch -replace '^.*(release[-/]v)'
16+
}
17+
else
18+
{
19+
Write-Verbose -Verbose "Branch is not a release branch. Defaulting to 99.99.99"
20+
"99.99.99"
21+
}
22+
}
23+
else {
24+
Write-Verbose -Verbose "PACKAGE_VERSION is not equal to 'fromBranch'"
25+
"99.99.99"
26+
}
27+
28+
$vstsCommandString = "vso[task.setvariable variable=PackageVersion]$packageVersion"
29+
Write-Verbose -Message "setting $Variable to $packageVersion" -Verbose
30+
Write-Host -Object "##$vstsCommandString"
31+
32+
displayName: Set version variable

0 commit comments

Comments
 (0)