Fix Gitea build workflow to verify and upload SPDX SBOM files, ensuring proper error handling and file existence checks.
All checks were successful
Go Build Multi-Platform / build (amd64, darwin) (push) Successful in 49s
Go Build Multi-Platform / build (amd64, freebsd) (push) Successful in 47s
Go Build Multi-Platform / build (amd64, windows) (push) Successful in 53s
Go Build Multi-Platform / build (amd64, linux) (push) Successful in 56s
Go Build Multi-Platform / build (arm, linux) (push) Successful in 1m2s
Go Build Multi-Platform / build (arm, freebsd) (push) Successful in 1m4s
Go Build Multi-Platform / build (arm, windows) (push) Successful in 53s
Go Build Multi-Platform / build (arm64, darwin) (push) Successful in 51s
Run Gosec / tests (push) Successful in 17s
Go Test Multi-Platform / Test (ubuntu-latest, arm64) (push) Successful in 43s
Go Build Multi-Platform / build (arm64, freebsd) (push) Successful in 49s
Go Build Multi-Platform / build (arm64, linux) (push) Successful in 56s
Go Build Multi-Platform / build (arm64, windows) (push) Successful in 54s
Go Build Multi-Platform / Create Release (push) Has been skipped
Go Revive Lint / lint (push) Successful in 9m31s
Go Test Multi-Platform / Test (ubuntu-latest, amd64) (push) Successful in 18m56s
All checks were successful
Go Build Multi-Platform / build (amd64, darwin) (push) Successful in 49s
Go Build Multi-Platform / build (amd64, freebsd) (push) Successful in 47s
Go Build Multi-Platform / build (amd64, windows) (push) Successful in 53s
Go Build Multi-Platform / build (amd64, linux) (push) Successful in 56s
Go Build Multi-Platform / build (arm, linux) (push) Successful in 1m2s
Go Build Multi-Platform / build (arm, freebsd) (push) Successful in 1m4s
Go Build Multi-Platform / build (arm, windows) (push) Successful in 53s
Go Build Multi-Platform / build (arm64, darwin) (push) Successful in 51s
Run Gosec / tests (push) Successful in 17s
Go Test Multi-Platform / Test (ubuntu-latest, arm64) (push) Successful in 43s
Go Build Multi-Platform / build (arm64, freebsd) (push) Successful in 49s
Go Build Multi-Platform / build (arm64, linux) (push) Successful in 56s
Go Build Multi-Platform / build (arm64, windows) (push) Successful in 54s
Go Build Multi-Platform / Create Release (push) Has been skipped
Go Revive Lint / lint (push) Successful in 9m31s
Go Test Multi-Platform / Test (ubuntu-latest, amd64) (push) Successful in 18m56s
This commit is contained in:
@@ -70,7 +70,20 @@ jobs:
|
||||
|
||||
- name: Generate SPDX SBOM with Trivy
|
||||
run: |
|
||||
trivy fs --format spdx-json --output dependency-results.sbom.json .
|
||||
trivy fs --format spdx-json --output dependency-results.sbom.json . || exit 1
|
||||
if [ ! -f dependency-results.sbom.json ]; then
|
||||
echo "Error: SBOM file was not created!"
|
||||
exit 1
|
||||
fi
|
||||
echo "SBOM file created successfully:"
|
||||
ls -lh dependency-results.sbom.json
|
||||
|
||||
- name: Verify SBOM files exist
|
||||
run: |
|
||||
echo "Checking for SBOM files..."
|
||||
ls -lh bom.json dependency-results.sbom.json || true
|
||||
test -f bom.json && echo "bom.json exists" || echo "bom.json missing"
|
||||
test -f dependency-results.sbom.json && echo "dependency-results.sbom.json exists" || echo "dependency-results.sbom.json missing"
|
||||
|
||||
- name: Upload Artifact
|
||||
uses: https://git.quad4.io/actions/upload-artifact@ff15f0306b3f739f7b6fd43fb5d26cd321bd4de5 # v3.2.1
|
||||
@@ -81,6 +94,14 @@ jobs:
|
||||
bom.json
|
||||
dependency-results.sbom.json
|
||||
|
||||
- name: Upload SPDX SBOM Artifact
|
||||
if: matrix.goos == 'linux' && matrix.goarch == 'amd64'
|
||||
uses: https://git.quad4.io/actions/upload-artifact@ff15f0306b3f739f7b6fd43fb5d26cd321bd4de5 # v3.2.1
|
||||
with:
|
||||
name: spdx-sbom
|
||||
path: dependency-results.sbom.json
|
||||
retention-days: 90
|
||||
|
||||
release:
|
||||
name: Create Release
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
Reference in New Issue
Block a user