Skip to content

chore: apply safe dependency security updates #57

chore: apply safe dependency security updates

chore: apply safe dependency security updates #57

name: Publish container image
on:
push:
branches: [main]
tags: ["v*"]
workflow_dispatch:
permissions:
attestations: write
contents: read
id-token: write
packages: write
concurrency:
group: container-image-${{ github.ref }}
cancel-in-progress: true
env:
REGISTRY: ghcr.io
IMAGE_NAME: jusso-dev/kelpie
jobs:
build_amd64:
name: Build linux/amd64 image
runs-on: ubuntu-24.04
timeout-minutes: 45
outputs:
digest: ${{ steps.build.outputs.digest }}
steps:
- name: Check out source
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.11.1
- name: Log in to GitHub Container Registry
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.5.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GHCR_TOKEN }}
- name: Build and publish image
id: build
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6.18.0
with:
context: .
platforms: linux/amd64
outputs: type=image,name=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }},push-by-digest=true,name-canonical=true,push=true
labels: |
org.opencontainers.image.title=Kelpie
org.opencontainers.image.description=Incident response and case management for small SOC teams
cache-from: |
type=gha,scope=kelpie-amd64
type=gha,scope=buildkit
cache-to: type=gha,scope=kelpie-amd64,mode=max
provenance: mode=max
sbom: true
build_arm64:
name: Build linux/arm64 image
runs-on: ubuntu-24.04-arm
timeout-minutes: 45
outputs:
digest: ${{ steps.build.outputs.digest }}
steps:
- name: Check out source
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.11.1
- name: Log in to GitHub Container Registry
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.5.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GHCR_TOKEN }}
- name: Build and publish image
id: build
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6.18.0
with:
context: .
platforms: linux/arm64
outputs: type=image,name=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }},push-by-digest=true,name-canonical=true,push=true
labels: |
org.opencontainers.image.title=Kelpie
org.opencontainers.image.description=Incident response and case management for small SOC teams
cache-from: |
type=gha,scope=kelpie-arm64
type=gha,scope=buildkit
cache-to: type=gha,scope=kelpie-arm64,mode=max
provenance: mode=max
sbom: true
publish_manifest:
name: Publish multi-platform manifest
needs: [build_amd64, build_arm64]
runs-on: ubuntu-24.04
timeout-minutes: 15
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.11.1
- name: Log in to GitHub Container Registry
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.5.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GHCR_TOKEN }}
- name: Extract image metadata
id: meta
uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5.8.0
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=tag
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha,prefix=sha-
type=raw,value=latest,enable={{is_default_branch}}
- name: Create and publish multi-platform manifest
id: manifest
env:
IMAGE_REF: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
TAGS: ${{ steps.meta.outputs.tags }}
AMD64_DIGEST: ${{ needs.build_amd64.outputs.digest }}
ARM64_DIGEST: ${{ needs.build_arm64.outputs.digest }}
run: |
set -euo pipefail
test -n "$AMD64_DIGEST"
test -n "$ARM64_DIGEST"
manifest_digest=""
while IFS= read -r tag; do
[ -n "$tag" ] || continue
create_output="$(docker buildx imagetools create \
--progress=plain \
--tag "$tag" \
"$IMAGE_REF@$AMD64_DIGEST" \
"$IMAGE_REF@$ARM64_DIGEST" 2>&1)"
printf '%s\n' "$create_output"
manifest_digest="$(printf '%s\n' "$create_output" | awk '/pushing sha256:/ { for (i = 1; i <= NF; i++) if ($i ~ /^sha256:/) digest = $i } END { print digest }')"
test -n "$manifest_digest"
done <<< "$TAGS"
test -n "$manifest_digest"
test "$manifest_digest" != "null"
echo "digest=$manifest_digest" >> "$GITHUB_OUTPUT"
- name: Attest image provenance
uses: actions/attest@f7c74d28b9d84cb8768d0b8ca14a4bac6ef463e6 # v4.2.0
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
subject-digest: ${{ steps.manifest.outputs.digest }}
push-to-registry: true