Skip to content

bump server, agent, shared submodules: cargo fmt #74

bump server, agent, shared submodules: cargo fmt

bump server, agent, shared submodules: cargo fmt #74

name: Container images
on:
workflow_dispatch:
inputs:
tag:
description: "Image tag to publish (e.g. v22). Leave blank to use the git ref name."
required: false
default: ""
mark_latest:
description: "Also tag :latest"
type: boolean
default: true
push:
branches: [main]
tags:
- 'v*'
permissions:
contents: read
packages: write
env:
REGISTRY: ghcr.io
IMAGE_PREFIX: ghcr.io/${{ github.repository_owner }}/shellfleet
jobs:
build:
name: build (${{ matrix.image }} · ${{ matrix.arch }})
strategy:
fail-fast: false
matrix:
image: [server, web, agent]
arch: [amd64, arm64]
include:
- arch: amd64
runner: ubuntu-latest
platform: linux/amd64
- arch: arm64
runner: ubuntu-24.04-arm
platform: linux/arm64
runs-on: ${{ matrix.runner }}
steps:
- name: Pick image tag
id: tag
run: |
if [ -n "${{ inputs.tag }}" ]; then
echo "value=${{ inputs.tag }}" >> "$GITHUB_OUTPUT"
else
echo "value=${{ github.ref_name }}" >> "$GITHUB_OUTPUT"
fi
- name: Checkout (with submodules)
uses: actions/checkout@v6
with:
submodules: recursive
token: ${{ secrets.SUBMODULES_PAT }}
- name: Set up Buildx
uses: docker/setup-buildx-action@v4
- name: Log in to GHCR
uses: docker/login-action@v4
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build + push (${{ matrix.platform }})
run: |
IMG="${{ matrix.image }}"
TAG="${{ steps.tag.outputs.value }}"
ARCH="${{ matrix.arch }}"
docker buildx build \
--platform ${{ matrix.platform }} \
-f Dockerfile.${IMG} \
-t ${{ env.IMAGE_PREFIX }}/${IMG}:${TAG}-${ARCH} \
--provenance false \
--push .
manifest:
name: assemble manifest (${{ matrix.image }})
needs: build
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
image: [server, web, agent]
steps:
- name: Pick image tag
id: tag
run: |
if [ -n "${{ inputs.tag }}" ]; then
echo "value=${{ inputs.tag }}" >> "$GITHUB_OUTPUT"
else
echo "value=${{ github.ref_name }}" >> "$GITHUB_OUTPUT"
fi
- name: Set up Buildx
uses: docker/setup-buildx-action@v4
- name: Log in to GHCR
uses: docker/login-action@v4
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build manifest list (${{ steps.tag.outputs.value }})
run: |
IMG="${{ matrix.image }}"
TAG="${{ steps.tag.outputs.value }}"
BASE="${{ env.IMAGE_PREFIX }}/${IMG}"
docker buildx imagetools create \
-t "${BASE}:${TAG}" \
"${BASE}:${TAG}-amd64" \
"${BASE}:${TAG}-arm64"
- name: Also tag :latest
# On push/tag events `inputs.mark_latest` is '' which coerces to
# false, so `'' != false` was false and :latest never moved. Tag
# :latest on any non-dispatch event, or when dispatch opts in.
if: ${{ github.event_name != 'workflow_dispatch' || inputs.mark_latest }}
run: |
IMG="${{ matrix.image }}"
TAG="${{ steps.tag.outputs.value }}"
BASE="${{ env.IMAGE_PREFIX }}/${IMG}"
docker buildx imagetools create \
-t "${BASE}:latest" \
"${BASE}:${TAG}-amd64" \
"${BASE}:${TAG}-arm64"