Skip to content

Commit 7db797c

Browse files
Merge pull request #110 from leanix/feature/cid-3581/upload-sbom
Fetch asset url
2 parents 83fab55 + 92b43ed commit 7db797c

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

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

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,22 @@ jobs:
6767
});
6868
console.log(`Published draft release for tag ${tag}`);
6969
70+
- name: Fetch upload_url for this tag
71+
id: get_release
72+
if: steps.tag-action.outputs.tag != ''
73+
uses: actions/github-script@v6
74+
with:
75+
github-token: ${{ secrets.GITHUB_TOKEN }}
76+
result-encoding: string
77+
script: |
78+
const tag = '${{ steps.tag-action.outputs.tag }}';
79+
const { data: release } = await github.rest.repos.getReleaseByTag({
80+
owner: context.repo.owner,
81+
repo: context.repo.repo,
82+
tag
83+
});
84+
return release.upload_url;
85+
7086
- name: Checkout
7187
uses: actions/checkout@v3
7288
if: (steps.tag-action.outputs.tag != '')
@@ -135,7 +151,7 @@ jobs:
135151
- name: Upload SBOM asset
136152
uses: actions/upload-release-asset@v1
137153
with:
138-
upload_url: ${{ steps.get_release.outputs.upload_url }}
154+
upload_url: ${{ steps.get_release.outputs.result }}
139155
asset_path: ${{ steps.derive-artifact-name.outputs.SBOM_DIR }}/${{ steps.derive-artifact-name.outputs.SBOM_ARTIFACT_NAME }}
140156
asset_name: ${{ steps.derive-artifact-name.outputs.SBOM_ARTIFACT_NAME }}
141157

0 commit comments

Comments
 (0)