From c885c640f08979cef5e27be95a567dd49b3943bc Mon Sep 17 00:00:00 2001 From: Tommy Date: Wed, 29 May 2024 11:30:58 -0700 Subject: [PATCH] Fix build workflow Signed-off-by: Tommy --- .github/workflows/build.yml | 37 +++++++++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e254d74..6e4c13f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,7 +18,7 @@ env: jobs: build: - name: Build, scan & push + name: Build & push new image runs-on: "ubuntu-latest" permissions: contents: read @@ -27,7 +27,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Extract version for tags run: | @@ -36,16 +36,14 @@ jobs: - name: Install cosign if: github.event_name != 'pull_request' - uses: sigstore/cosign-installer@main - with: - cosign-release: 'v2.0.1' + uses: sigstore/cosign-installer@v3 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 - name: Login to registry if: github.event_name != 'pull_request' - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: registry: ${{ env.REGISTRY }} username: ${{ github.repository_owner }} @@ -53,7 +51,7 @@ jobs: - name: Set Docker metadata id: meta - uses: docker/metadata-action@v4 + uses: docker/metadata-action@v5 with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} tags: | @@ -63,7 +61,7 @@ jobs: - name: Build and push Docker image id: build-and-push - uses: docker/build-push-action@v3 + uses: docker/build-push-action@v5 with: context: . push: ${{ github.event_name != 'pull_request' }} @@ -74,5 +72,24 @@ jobs: if: ${{ github.event_name != 'pull_request' }} run: cosign sign ${TAGS} -y env: - COSIGN_EXPERIMENTAL: "true" TAGS: ${{ steps.meta.outputs.tags }} + + scan: + name: Scan current image & report results + needs: build + runs-on: "ubuntu-latest" + steps: + - name: Run Trivy vulnerability scanner + uses: aquasecurity/trivy-action@master + with: + image-ref: 'ghcr.io/wonderfall/synapse' + format: 'template' + template: '@/contrib/sarif.tpl' + output: 'trivy-results.sarif' + severity: 'CRITICAL,HIGH' + vuln-type: "os" + + - name: Upload Trivy scan results to GitHub Security tab + uses: github/codeql-action/upload-sarif@v2 + with: + sarif_file: 'trivy-results.sarif' \ No newline at end of file