Skip to content

Commit 0a4ae9f

Browse files
Merge pull request #111 from leanix/feature/cid-3581/generate-sbom-artifact
CID-3581: Generate and upload SBOM if new tag is generated
2 parents 7db797c + ef6b53a commit 0a4ae9f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

.github/workflows/publish-package-to-ghcr.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,13 +128,15 @@ jobs:
128128

129129
- name: Derive SBOM artifact name
130130
id: derive-artifact-name
131+
if: (steps.tag-action.outputs.tag != '')
131132
shell: bash
132133
run: |
133134
# These are outputs (not vars) so that they can be used as input to the upload step
134135
echo "SBOM_ARTIFACT_NAME=$(echo ${{ env.IMAGE_NAME }}-public-sbom | sed 's/\//_/g')" >> $GITHUB_OUTPUT
135136
echo "SBOM_DIR=./sbom" >> $GITHUB_OUTPUT
136137
137138
- name: Generate SBOM artifact
139+
if: (steps.tag-action.outputs.tag != '')
138140
run: |
139141
curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s --
140142
./bin/syft --version
@@ -144,12 +146,14 @@ jobs:
144146
145147
- name: Upload SBOM artifact
146148
uses: actions/upload-artifact@v4
149+
if: (steps.tag-action.outputs.tag != '')
147150
with:
148151
name: ${{ steps.derive-artifact-name.outputs.SBOM_ARTIFACT_NAME }}
149152
path: ${{ steps.derive-artifact-name.outputs.SBOM_DIR }}
150153

151154
- name: Upload SBOM asset
152155
uses: actions/upload-release-asset@v1
156+
if: (steps.tag-action.outputs.tag != '')
153157
with:
154158
upload_url: ${{ steps.get_release.outputs.result }}
155159
asset_path: ${{ steps.derive-artifact-name.outputs.SBOM_DIR }}/${{ steps.derive-artifact-name.outputs.SBOM_ARTIFACT_NAME }}

0 commit comments

Comments
 (0)