Skip to content

Merge pull request #76 from encryption4all/release-plz-2026-03-27T09-… #103

Merge pull request #76 from encryption4all/release-plz-2026-03-27T09-…

Merge pull request #76 from encryption4all/release-plz-2026-03-27T09-… #103

Workflow file for this run

name: Delivery
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
permissions:
contents: read
packages: write
security-events: write
jobs:
build-amd64:
runs-on: ubuntu-latest
outputs:
digest: ${{ steps.build.outputs.digest }}
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Select build profile
id: config
run: |
TAG=$(git tag --points-at HEAD | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+' | head -1)
if [[ -n "${TAG}" ]]; then
echo "profile=release" >> "$GITHUB_OUTPUT"
else
echo "profile=edge" >> "$GITHUB_OUTPUT"
fi
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Login to GitHub Container Registry
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push (linux/amd64)
id: build
uses: docker/build-push-action@v7
with:
context: .
platforms: linux/amd64
push: true
provenance: false
tags: ghcr.io/${{ github.repository }}:build-${{ github.run_id }}-amd64
build-args: CARGO_PROFILE=${{ steps.config.outputs.profile }}
cache-from: type=gha,scope=build-amd64
cache-to: type=gha,mode=max,scope=build-amd64
- name: Scan image
uses: anchore/scan-action@7037fa011853d5a11690026fb85feee79f4c946c # v7.3.2
id: scan
with:
image: ghcr.io/${{ github.repository }}:build-${{ github.run_id }}-amd64
only-fixed: true
fail-build: true
severity-cutoff: critical
output-format: sarif
- name: Upload Anchore scan SARIF report
uses: github/codeql-action/upload-sarif@c793b717bc78562f491db7b0e93a3a178b099162 # v4
if: ${{ !cancelled() }}
with:
sarif_file: ${{ steps.scan.outputs.sarif }}
build-arm64:
runs-on: ubuntu-24.04-arm
outputs:
digest: ${{ steps.build.outputs.digest }}
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Select build profile
id: config
run: |
TAG=$(git tag --points-at HEAD | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+' | head -1)
if [[ -n "${TAG}" ]]; then
echo "profile=release" >> "$GITHUB_OUTPUT"
else
echo "profile=edge" >> "$GITHUB_OUTPUT"
fi
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Login to GitHub Container Registry
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push (linux/arm64)
id: build
uses: docker/build-push-action@v7
with:
context: .
platforms: linux/arm64
push: true
provenance: false
tags: ghcr.io/${{ github.repository }}:build-${{ github.run_id }}-arm64
build-args: CARGO_PROFILE=${{ steps.config.outputs.profile }}
cache-from: type=gha,scope=build-arm64
cache-to: type=gha,mode=max,scope=build-arm64
merge:
runs-on: ubuntu-latest
needs: [build-amd64, build-arm64]
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Detect release tag on HEAD
id: release
run: |
TAG=$(git tag --points-at HEAD | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+' | head -1)
echo "tag=${TAG}" >> "$GITHUB_OUTPUT"
echo "is_release=$([[ -n "${TAG}" ]] && echo true || echo false)" >> "$GITHUB_OUTPUT"
- name: Docker meta
id: meta
uses: docker/metadata-action@v6
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=semver,pattern={{version}},value=${{ steps.release.outputs.tag }},enable=${{ steps.release.outputs.is_release == 'true' }}
type=semver,pattern={{major}}.{{minor}},value=${{ steps.release.outputs.tag }},enable=${{ steps.release.outputs.is_release == 'true' }}
type=edge,enable=${{ steps.release.outputs.is_release != 'true' }}
type=ref,event=pr
type=ref,event=branch,enable=${{ github.event_name == 'workflow_dispatch' }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Login to GitHub Container Registry
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Combine the two platform-specific images into a single multi-arch manifest.
# DOCKER_METADATA_OUTPUT_JSON is set automatically by docker/metadata-action.
- name: Create and push multi-arch manifest
run: |
docker buildx imagetools create \
$(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
"ghcr.io/${{ github.repository }}@${{ needs.build-amd64.outputs.digest }}" \
"ghcr.io/${{ github.repository }}@${{ needs.build-arm64.outputs.digest }}"