Skip to content

Merge pull request #13 from intelops/ext-db #3

Merge pull request #13 from intelops/ext-db

Merge pull request #13 from intelops/ext-db #3

name: qualitytrace-server Docker Image CI
on:
push:
paths-ignore:
- '**.md'
- 'charts/**'
branches:
- 'main'
jobs:
build:
runs-on: ubuntu-latest
permissions:
packages: write
id-token: write
contents: read
actions: read
security-events: write
env:
REGISTRY: ghcr.io
GH_URL: https://github.com
registry_username: ${{ github.actor }}
registry_password: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout GitHub Action
uses: actions/checkout@v3
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: Set up Go environment
uses: actions/setup-go@v4
with:
go-version: '1.21'
- name: Build server
run: make dist/qualitytrace-server
env:
GO111MODULE: on
- name: Docker metadata
id: metadata
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ github.repository }}
tags: |
type=raw,value=latest
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=raw,value={{sha}},enable=${{ github.ref_type != 'tag' }}
flavor: |
latest=true
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ env.registry_username }}
password: ${{ env.registry_password }}
- name: Build image and push to GitHub Container Registry
uses: docker/build-push-action@v4
with:
context: .
file: ./dockerfiles/server/Dockerfile
tags: |
${{ env.REGISTRY }}/${{ github.repository }}:${{ github.run_id }},
${{ env.REGISTRY }}/${{ github.repository }}:latest
labels: ${{ steps.metadata.outputs.labels }}
push: true
- name: Install cosign
uses: sigstore/cosign-installer@main
- name: Sign the images
run: |
cosign sign -y ${{ env.REGISTRY }}/${{ github.repository }}:${{ github.run_id }}
env:
COSIGN_EXPERIMENTAL: 1
- name: Verify the pushed tags
run: cosign verify ${{ env.REGISTRY }}/${{ github.repository }}:${{ github.run_id }} --certificate-identity ${{ env.GH_URL }}/${{ github.repository }}/.github/workflows/qualitytrace-server.yaml@refs/heads/main --certificate-oidc-issuer https://token.actions.githubusercontent.com
env:
COSIGN_EXPERIMENTAL: 1
- name: Run Trivy in GitHub SBOM mode and submit results to Dependency Graph
uses: aquasecurity/trivy-action@master
with:
scan-type: 'fs'
format: 'github'
output: 'dependency-results.sbom.json'
image-ref: '.'
github-pat: ${{ env.registry_password }}