Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Generate SBOM #245

Merged
merged 2 commits into from
Mar 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 33 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- main

jobs:
release-package:
release-please:
runs-on: ubuntu-latest

steps:
Expand All @@ -16,14 +16,21 @@ jobs:
command: manifest
token: ${{secrets.GITHUB_TOKEN}}
default-branch: main
outputs:
release_created: ${{ steps.release.outputs.release_created }}
release_tag_name: ${{ steps.release.outputs.tag_name }}

release:
runs-on: ubuntu-latest
needs: release-please
if: ${{ needs.release-please.outputs.release_created }}

steps:
- uses: actions/checkout@v4
if: ${{ steps.release.outputs.releases_created }}
with:
fetch-depth: 0

- name: Setup .NET SDK
if: ${{ steps.release.outputs.releases_created }}
uses: actions/setup-dotnet@v4
env:
NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -34,13 +41,33 @@ jobs:
source-url: https://nuget.pkg.github.com/open-feature/index.json

- name: Install dependencies
if: ${{ steps.release.outputs.releases_created }}
run: dotnet restore

- name: Pack
if: ${{ steps.release.outputs.releases_created }}
run: dotnet pack --no-restore

- name: Publish to Nuget
if: ${{ steps.release.outputs.releases_created }}
run: dotnet nuget push "src/**/*.nupkg" --api-key "${{ secrets.NUGET_TOKEN }}" --source https://api.nuget.org/v3/index.json

sbom:
runs-on: ubuntu-latest
needs: release-please
continue-on-error: true
if: ${{ needs.release-please.outputs.release_created }}
jenshenneberg marked this conversation as resolved.
Show resolved Hide resolved

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install CycloneDX.NET
run: dotnet tool install CycloneDX

- name: Generate .NET BOM
run: dotnet CycloneDX --json --exclude-dev -sv "${{ needs.release-please.outputs.release_tag_name }}" ./src/OpenFeature/OpenFeature.csproj

- name: Attach SBOM to artifact
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
run:
gh release upload ${{ needs.release-please.outputs.release_tag_name }} bom.json
Loading