forked from gatewayd-io/gatewayd
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7b42cf5
commit 24ce96b
Showing
1 changed file
with
31 additions
and
39 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 |
---|---|---|
@@ -1,58 +1,50 @@ | ||
name: Build and release test | ||
name: Vulnerability Comparison | ||
|
||
on: | ||
push: | ||
branches: | ||
- "feature/integrate_docker_scout_with_gitHub_actions" | ||
tags: ["*"] | ||
pull_request: | ||
branches: ["**"] | ||
|
||
permissions: | ||
contents: write | ||
env: | ||
# Image repository, without hostname and tag | ||
IMAGE_NAME: ${{ github.repository }} | ||
SHA: ${{ github.event.pull_request.head.sha || github.event.after }} | ||
|
||
jobs: | ||
build-and-release: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
packages: write | ||
pull-requests: write | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Set up Go 1.22 | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: "1.22" | ||
cache: true | ||
- name: Install nfpm for building Linux packages | ||
run: go install github.com/goreleaser/nfpm/v2/cmd/nfpm@latest | ||
- name: Build and release binaries | ||
run: make build-release | ||
- name: Build and release Linux packages | ||
run: make build-linux-packages | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
ref: ${{ env.SHA }} | ||
- name: Set short SHA | ||
id: vars | ||
run: echo "SHA_SHORT=$(echo $GITHUB_SHA | cut -c1-7)" >> $GITHUB_ENV | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- name: Sign in to GitHub Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Extract metadata | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: | | ||
gatewaydio/gatewayd | ||
ghcr.io/gatewayd-io/gatewayd | ||
- name: Build and push Docker image | ||
id: build-and-push | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
sbom: true | ||
provenance: mode=max | ||
tags: "ghcr.io/sinadarbouy/gatewayd:test" | ||
load: ${{ github.event_name == 'pull_request' }} | ||
tags: "ghcr.io/${{ env.IMAGE_NAME }}:${{ env.SHA_SHORT }}" | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
- name: Authenticate to Docker | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKER_USER }} | ||
password: ${{ secrets.DOCKER_PAT }} | ||
- name: Docker Scout | ||
id: docker-scout | ||
uses: docker/scout-action@v1 | ||
with: | ||
command: compare | ||
image: "gatewaydio/gatewayd:latest" | ||
to: "ghcr.io/${{ env.IMAGE_NAME }}:${{ env.SHA_SHORT }}" | ||
ignore-unchanged: true | ||
only-severities: critical,high | ||
github-token: ${{ secrets.GITHUB_TOKEN }} |