Skip to content

Commit e10bb48

Browse files
author
Divyanshu Jethi
committed
feat(ci): add automated CycloneDX & SPDX SBOM generation on release with anchore/sbom-action
1 parent 553eea9 commit e10bb48

1 file changed

Lines changed: 46 additions & 1 deletion

File tree

‎.github/workflows/publish-pypi.yml‎

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,26 @@ jobs:
2929
- name: Build a binary wheel and a source tarball
3030
run: python3 -m build
3131

32+
- name: Generate CycloneDX SBOM
33+
uses: anchore/sbom-action@66cbf4bc1f1c0d2edc94016e65bc221b6bb0ad6c # v0.24.3
34+
with:
35+
path: ./
36+
format: 'cyclonedx-json'
37+
output-file: 'dist/agentshield-python-cyclonedx.sbom.json'
38+
artifact-name: 'agentshield-python-cyclonedx.sbom.json'
39+
upload-artifact: true
40+
upload-release-assets: false
41+
42+
- name: Generate SPDX SBOM
43+
uses: anchore/sbom-action@66cbf4bc1f1c0d2edc94016e65bc221b6bb0ad6c # v0.24.3
44+
with:
45+
path: ./
46+
format: 'spdx-json'
47+
output-file: 'dist/agentshield-python-spdx.sbom.json'
48+
artifact-name: 'agentshield-python-spdx.sbom.json'
49+
upload-artifact: true
50+
upload-release-assets: false
51+
3252
- name: Store the distribution packages
3353
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.0
3454
with:
@@ -58,4 +78,29 @@ jobs:
5878
uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # v1.12.4
5979
with:
6080
password: ${{ secrets.PYPI_API_TOKEN }}
61-
skip-existing: true
81+
82+
create-release:
83+
name: Create GitHub Release with SBOM Artifacts
84+
needs:
85+
- publish-to-pypi
86+
if: startsWith(github.ref, 'refs/tags/v')
87+
runs-on: ubuntu-latest
88+
permissions:
89+
contents: write
90+
steps:
91+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
92+
93+
- name: Download all the dists
94+
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.0
95+
with:
96+
name: python-package-distributions
97+
path: dist/
98+
99+
- name: Create GitHub Release
100+
uses: softprops/action-gh-release@c062e08bd5328157348241fa0833b7d8b97943b7 # v2.0.8
101+
with:
102+
generate_release_notes: true
103+
files: |
104+
dist/*
105+
env:
106+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)