-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from aneisch/sbom
SBOM
- Loading branch information
Showing
2 changed files
with
21 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,15 @@ jobs: | |
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Run Trivy in GitHub SBOM mode and submit results to Dependency Graph | ||
uses: aquasecurity/[email protected] | ||
with: | ||
scan-type: 'fs' | ||
format: 'github' | ||
output: 'dependency-results.sbom.json' | ||
image-ref: '.' | ||
github-pat: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Attempt Build | ||
run: docker build . --file Dockerfile -t $IMAGE_NAME | ||
|
||
|
@@ -37,21 +46,18 @@ jobs: | |
- name: Log into Registry | ||
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | ||
|
||
- name: Push Image | ||
run: | | ||
IMAGE_ID=ghcr.io/aneisch/${{ env.IMAGE_NAME }} | ||
# Change all uppercase to lowercase | ||
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') | ||
# Strip git ref prefix from version | ||
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') | ||
# Strip "v" prefix from tag name | ||
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') | ||
# Use Docker `latest` tag convention | ||
[ "$VERSION" == "master" ] && VERSION=latest | ||
echo IMAGE_ID=$IMAGE_ID | ||
echo VERSION=$VERSION | ||
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION | ||
docker push $IMAGE_ID:$VERSION | ||
- name: Build and push container image | ||
id: push-step | ||
uses: docker/build-push-action@master | ||
with: | ||
push: true | ||
tags: ghcr.io/aneisch/${{ env.IMAGE_NAME }}:latest | ||
|
||
- name: Install cosign | ||
uses: sigstore/cosign-installer@main | ||
|
||
- name: Sign the container image | ||
run: cosign sign --yes ghcr.io/aneisch/${{ env.IMAGE_NAME }}@${{ steps.push-step.outputs.digest }} | ||
|
||
build_multiarch: | ||
runs-on: ubuntu-latest | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters