Skip to content

Bugfix

Bugfix #13

Workflow file for this run

name: Chainguard Image Build
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: maven
- name: Build with Maven
run: mvn clean package -DskipTests
- name: Upload JAR as artifact
uses: actions/upload-artifact@v4
with:
name: heartflame-fleet
path: target/fleet-1.0-SNAPSHOT.jar
docker:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v4
- name: Download JAR artifact
uses: actions/download-artifact@v4
with:
name: heartflame-fleet
- name: Log in to GitHub Container Registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Build Docker image
run: docker build -t heartflame-fleet:${{ github.sha }} .
- name: Tag Docker image as latest
if: github.ref == 'refs/heads/main'
run: docker tag heartflame-fleet:${{ github.sha }} ghcr.io/heartflamesoftware/heartflame-fleet:latest
- name: Scan Docker image with Trivy
uses: aquasecurity/trivy-action@0.20.0
with:
image-ref: 'heartflame-fleet:${{ github.sha }}'
format: 'sarif'
output: 'trivy-results.sarif'
severity: 'CRITICAL,HIGH'
exit-code: '0'
- name: Upload Trivy SARIF Report
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: 'trivy-results.sarif'
- name: Push Docker image to GHCR
if: success()
run: |
docker push ghcr.io/heartflamesoftware/heartflame-fleet:${{ github.sha }}
if [ "${{ github.ref }}" == "refs/heads/main" ]; then
docker push ghcr.io/heartflamesoftware/heartflame-fleet:latest
fi