Skip to content

Commit dc9ad27

Browse files
authored
Update nuget-publish.yml
1 parent 71e5018 commit dc9ad27

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

.github/workflows/nuget-publish.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,21 +50,23 @@ jobs:
5050
5151
- name: Generate SBOM
5252
run: |
53-
# Get version from tag
54-
VERSION=${GITHUB_REF#refs/tags/}
53+
git fetch --tags
54+
VERSION=$(git describe --tags --abbrev=0)
55+
echo "Latest tag: $VERSION"
5556
mkdir -p sbom/$VERSION
5657
dotnet tool run dotnet-CycloneDX OpenCode/OpenCode.csproj -o sbom/$VERSION -f json
57-
58-
- name: Commit SBOM to repository
58+
59+
- name: Commit SBOM
5960
env:
6061
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6162
run: |
62-
VERSION=${GITHUB_REF#refs/tags/}
63+
VERSION=$(git describe --tags --abbrev=0)
6364
git config user.name "github-actions[bot]"
6465
git config user.email "github-actions[bot]@users.noreply.github.com"
6566
git add sbom/$VERSION/bom.json
6667
git commit -m "Add SBOM for version $VERSION" || echo "No changes to commit"
67-
git push origin HEAD:${GITHUB_REF_NAME:-main}
68+
git push origin HEAD
69+
6870
6971
- name: Pack
7072
if: matrix.dotnet-version == '9.x'

0 commit comments

Comments
 (0)