Add a Docker workflow that publishes multi-arch images
CI / test (push) Successful in 1m56s
Docker / image (push) Successful in 1m56s

Pushes :edge for main and :x.y.z, :x.y and :latest for release tags,
optionally mirrored to another registry. The release workflow no longer
builds the image itself, so a tag does not publish it twice. The README
covers running the image anywhere and the settings the workflows read.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
VeillaxandClaude Sonnet 5.5 committed 2026-10-26 23:13:54 -06:00
1 parent b53af0e196
commit 8f01c6213f
3 files changed
+122 -30

No files matched your search

+1 -24
View File
@@ -1,6 +1,6 @@
name: Release
# Push a tag such as v0.2.0 to build and publish a release:
# Push a tag such as v0.2.0 to publish a release. The Docker workflow builds the image from the same tag:
# git tag -a v0.2.0 -m "spinner v0.2.0" && git push origin v0.2.0
on:
push:
@@ -37,26 +37,3 @@ jobs:
env:
TOKEN: ${{ secrets.RELEASE_TOKEN || secrets.GITHUB_TOKEN }}
run: sh deploy/publish-release.sh "${GITHUB_REF_NAME}"
# Skipped when the repository variable PUBLISH_DOCKER is "false", or fails alone
# if this runner has no Docker: the release above is already published by then.
# Optional secret REGISTRY_TOKEN (and variable REGISTRY_USER): an access token
# with package write permission, for servers where the job token can't push.
- name: Build and push the container image
if: ${{ vars.PUBLISH_DOCKER != 'false' }}
env:
REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN || secrets.GITHUB_TOKEN }}
REGISTRY_USER: ${{ vars.REGISTRY_USER || github.actor }}
run: |
host=${GITHUB_SERVER_URL#*://}
owner=$(echo "$GITHUB_REPOSITORY_OWNER" | tr 'A-Z' 'a-z')
image="$host/$owner/spinner"
echo "$REGISTRY_TOKEN" | docker login "$host" -u "$REGISTRY_USER" --password-stdin
# a container-driver builder can build several architectures in one go
docker buildx create --name release --driver docker-container --use >/dev/null 2>&1 || docker buildx use release
tags="-t $image:$GITHUB_REF_NAME"
case "$GITHUB_REF_NAME" in
*-*) ;; # pre-releases (v1.0.0-rc1) don't move :latest
*) tags="$tags -t $image:latest" ;;
esac
docker buildx build --platform linux/amd64,linux/arm64 $tags --push .