Skip to content

Commit c717327

Browse files
Add SBOM generation with error handling to release workflow
1 parent 3e15042 commit c717327

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,13 @@ jobs:
138138
echo "Build digest: ${{ steps.build.outputs.digest }}"
139139
echo "Image reference: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@${{ steps.build.outputs.digest }}"
140140
141+
# Generate SBOM for the Docker image
142+
# Note: continue-on-error is set because the action tries to attach SBOM to a release
143+
# that doesn't exist yet. The SBOM file is still created successfully and will be
144+
# manually attached to the release in the create-release job.
141145
- name: Generate SBOM
142146
uses: anchore/sbom-action@v0
147+
continue-on-error: true
143148
with:
144149
image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@${{ steps.build.outputs.digest }}
145150
format: spdx-json
@@ -149,6 +154,16 @@ jobs:
149154
env:
150155
GITHUB_TOKEN: ''
151156

157+
- name: Verify SBOM was created
158+
run: |
159+
if [ -f "sbom-${{ needs.validate-tag.outputs.version }}.spdx.json" ]; then
160+
echo "✅ SBOM file created successfully"
161+
ls -lh sbom-${{ needs.validate-tag.outputs.version }}.spdx.json
162+
else
163+
echo "❌ SBOM file not found"
164+
exit 1
165+
fi
166+
152167
- name: Upload SBOM artifact
153168
uses: actions/upload-artifact@v4
154169
with:

0 commit comments

Comments
 (0)