Skip to content

chore(deps): update actions/upload-artifact action to v4 #38

chore(deps): update actions/upload-artifact action to v4

chore(deps): update actions/upload-artifact action to v4 #38

Workflow file for this run

name: Build image
on:
push:
branches: [main]
tags:
- v*
pull_request:
types: [opened, reopened, synchronize]
env:
PLATFORMS: linux/amd64,linux/arm64
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
arrays:
- image: ghcr.io/${{ github.repository }}
context: .
dockerfile: Dockerfile
push: "true"
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Install regctl
uses: iarekylew00t/regctl-installer@v1
- name: Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
context: workflow
images: ${{ matrix.arrays.image }}
tags: |
type=sha,format=long
type=raw,value=latest
type=semver,pattern={{version}}
- name: Create docker context
run: docker context create builders
- name: Setup docker buildx
id: buildx
uses: docker/setup-buildx-action@v3
with:
platforms: ${{ env.PLATFORMS }}
endpoint: builders
version: v0.12.0
- name: Build OCI image
uses: docker/build-push-action@v5
with:
context: ${{ matrix.arrays.context }}
file: ${{ matrix.arrays.dockerfile }}
build-args: REVISION=${{ github.sha }}
platforms: ${{ env.PLATFORMS }}
builder: ${{ steps.buildx.outputs.name }}
provenance: "false"
push: "false"
labels: ${{ steps.meta.outputs.labels }}
outputs: type=oci,tar=false,dest=build-image-oci
- name: Run trivy vulnerability scanner
uses: aquasecurity/trivy-action@18f2510ee396bbf400402947b394f2dd8c87dbb0
with:
input: build-image-oci
format: table
output: trivy-report.txt
exit-code: "0"
ignore-unfixed: "true"
vuln-type: os,library
severity: HIGH,CRITICAL
timeout: 10m
- name: Output trivy report
run: cat trivy-report.txt >> $GITHUB_STEP_SUMMARY
- name: Upload trivy report
uses: actions/upload-artifact@v4
with:
name: trivy-report
path: trivy-report.txt
retention-days: "90"
- name: Push OCI image
if: github.event_name == 'push' && matrix.arrays.push == 'true'
shell: bash
run: |
set -eux
tags="${{ steps.meta.outputs.tags }}"
for tag in $tags; do
regctl image copy ocidir://build-image-oci "$tag"
done