Skip to content

Commit 5da79ac

Browse files
authored
Update nuget-publish.yml
1 parent 0c2e468 commit 5da79ac

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

.github/workflows/nuget-publish.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ jobs:
4949
dotnet tool install CycloneDX
5050
5151
- name: Generate SBOM for latest tag on branch
52+
id: generate_sbom
5253
run: |
5354
git fetch --tags
5455
BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)
@@ -62,17 +63,15 @@ jobs:
6263

6364
mkdir -p sbom/$VERSION
6465
dotnet tool run dotnet-CycloneDX OpenCode/OpenCode.csproj -o sbom/$VERSION -f json
65-
66+
67+
# Set step output
68+
echo "version=$VERSION" >> $GITHUB_OUTPUT
69+
6670
- name: Commit SBOM
6771
env:
6872
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6973
run: |
70-
# Use same version logic as SBOM generation
71-
BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)
72-
VERSION=$(git tag --merged $BRANCH_NAME --sort=-v:refname | head -n1)
73-
if [ -z "$VERSION" ]; then
74-
VERSION=$(git rev-parse --short HEAD)
75-
fi
74+
VERSION=${{ steps.generate_sbom.outputs.version }}
7675
echo "Committing SBOM for version: $VERSION"
7776
7877
git config user.name "github-actions[bot]"
@@ -82,6 +81,7 @@ jobs:
8281
git push origin HEAD
8382

8483

84+
8585
- name: Pack
8686
if: matrix.dotnet-version == '9.x'
8787
run: dotnet pack --configuration Release --no-build --output ./nupkg

0 commit comments

Comments
 (0)