Fix provenance task #21
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
name: Build package and images | |
on: | |
push: | |
branches: | |
- '*' | |
permissions: read-all | |
jobs: | |
build-image: | |
runs-on: ubuntu-latest | |
permissions: | |
security-events: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up JDK 17 for x64 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'liberica' | |
architecture: x64 | |
- name: Maven build | |
run: ./mvnw --batch-mode --update-snapshots verify | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USER }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build image | |
run: docker build . --file Dockerfile --platform linux/amd64 --tag "andifalk/supply-chain-security:latest" | |
- name: Push image | |
run: docker push andifalk/supply-chain-security:latest | |
- name: Run Trivy vulnerability scanner | |
uses: aquasecurity/trivy-action@master | |
with: | |
image-ref: 'docker.io/andifalk/supply-chain-security:latest' | |
severity: 'CRITICAL,HIGH' | |
format: 'sarif' | |
output: 'trivy-results.sarif' | |
- name: Upload Trivy scan results to GitHub Security tab | |
uses: github/codeql-action/upload-sarif@v2 | |
with: | |
sarif_file: 'trivy-results.sarif' |