name: Generate SBOM
on:
  workflow_dispatch:
  release:
    types: [published]
permissions:
  contents: write
jobs:
  generate_sbom_action:
    runs-on: ubuntu-latest
    name: Install bom and generate SBOM
    steps:
      - name: Checkout repository
        uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
      - name: Install bom
        uses: kubernetes-sigs/release-actions/setup-bom@2f8b9ec22aedc9ce15039b6c7716aa6c2907df1c # main
      - name: Generage SBOM
        run: |
          bom generate -o minikube_${{github.ref_name}}_sbom.spdx \
          --dirs=.\
      - name: Upload SBOM
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: |
          gh release upload ${{github.ref_name}} minikube_${{github.ref_name}}_sbom.spdx
