Skip to content

Commit 5a49b0b

Browse files
authored
Upload Windows SBOMs to python.org (#117)
1 parent 54e0b60 commit 5a49b0b

2 files changed

Lines changed: 28 additions & 0 deletions

File tree

windows-release/stage-publish-pythonorg.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,17 @@ jobs:
5757
buildVersionToDownload: specific
5858
buildId: ${{ parameters.BuildToPublish }}
5959

60+
- task: DownloadBuildArtifacts@0
61+
displayName: 'Download artifact from ${{ parameters.BuildToPublish }}: sbom'
62+
inputs:
63+
artifactName: sbom
64+
downloadPath: $(Build.BinariesDirectory)\sbom
65+
buildType: specific
66+
project: $(System.TeamProject)
67+
pipeline: $(Build.DefinitionName)
68+
buildVersionToDownload: specific
69+
buildId: ${{ parameters.BuildToPublish }}
70+
6071
- ${{ else }}:
6172
- task: DownloadPipelineArtifact@1
6273
displayName: 'Download artifact: Doc'
@@ -77,6 +88,12 @@ jobs:
7788
artifactName: embed
7889
downloadPath: $(Build.BinariesDirectory)
7990

91+
# Note that sbom is a 'build' artifact, not a 'pipeline' artifact
92+
- task: DownloadBuildArtifacts@0
93+
displayName: 'Download artifact: sbom'
94+
inputs:
95+
artifactName: sbom
96+
downloadPath: $(Build.BinariesDirectory)\sbom
8097

8198
# Note that ARM64 MSIs are skipped at build when this option is specified
8299
- powershell: 'gci *embed-arm*.zip | %{ Write-Host "Not publishing: $($_.Name)"; gi $_ } | del'
@@ -133,6 +150,7 @@ jobs:
133150
-keyfile "$(sshkey.secureFilePath)"
134151
-doc_htmlhelp doc\htmlhelp
135152
-embed embed
153+
-sbom sbom
136154
workingDirectory: $(Build.BinariesDirectory)
137155
condition: and(succeeded(), eq(variables['IsRealSigned'], 'true'))
138156
displayName: 'Upload files to python.org'

windows-release/uploadrelease.ps1

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ param(
3030
[string]$tests=${env:TEMP},
3131
[string]$doc_htmlhelp=$null,
3232
[string]$embed=$null
33+
[string]$sbom=$null
3334
)
3435

3536
if (-not $build) { throw "-build option is required" }
@@ -87,19 +88,28 @@ $dirs = gci "$build" -Directory
8788
if ($embed) {
8889
$dirs = ($dirs, (gi $embed)) | %{ $_ }
8990
}
91+
if ($sbom) {
92+
$dirs = ($dirs, $sbom) | %{ $_ }
93+
}
9094

9195
foreach ($a in $dirs) {
9296
"Uploading files from $($a.FullName)"
9397
pushd "$($a.FullName)"
9498
$exe = gci *.exe, *.exe.asc, *.zip, *.zip.asc
9599
$msi = gci *.msi, *.msi.asc, *.msu, *.msu.asc
100+
$spdx_json = gci *.spdx.json
96101
popd
97102

98103
if ($exe) {
99104
& $pscp -batch -hostkey $hostkey -noagent -i $keyfile $exe.FullName "$user@${server}:$d"
100105
if (-not $?) { throw "Failed to upload $exe" }
101106
}
102107

108+
if ($spdx_json) {
109+
& $pscp -batch -hostkey $hostkey -noagent -i $keyfile $spdx_json.FullName "$user@${server}:$d"
110+
if (-not $?) { Write-Host "##[warning]Failed to upload $spdx_json" }
111+
}
112+
103113
if ($msi) {
104114
$sd = "$d$($a.Name)$($p[1])/"
105115
& $plink -batch -hostkey $hostkey -noagent -i $keyfile "$user@$server" mkdir $sd

0 commit comments

Comments
 (0)