2026-06-29 21:56:12 -05:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
# publish-image.sh — tag and push the runner image to a registry
|
|
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
|
|
IMAGE_NAME="${IMAGE_NAME:-custom-gitea-runner}"
|
|
|
|
|
REGISTRY="${REGISTRY:-registry.alwisp.com}"
|
2026-06-29 22:03:58 -05:00
|
|
|
# Gitea Container Registry namespaces images under an owner (user/org), e.g.
|
|
|
|
|
# registry.alwisp.com/<owner>/<image>. Set REGISTRY_NAMESPACE to that owner.
|
|
|
|
|
REGISTRY_NAMESPACE="${REGISTRY_NAMESPACE:-jason}"
|
2026-06-29 21:56:12 -05:00
|
|
|
VERSION="${VERSION:-}"
|
|
|
|
|
|
|
|
|
|
if [ -z "$VERSION" ]; then
|
|
|
|
|
echo "[ERROR] VERSION must be set (e.g. VERSION=v0.1.0 ./scripts/publish-image.sh)"
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
|
2026-06-29 22:03:58 -05:00
|
|
|
# Build the remote repository path, including the namespace when one is set.
|
|
|
|
|
if [ -n "${REGISTRY_NAMESPACE}" ]; then
|
|
|
|
|
REMOTE_REPO="${REGISTRY}/${REGISTRY_NAMESPACE}/${IMAGE_NAME}"
|
|
|
|
|
else
|
|
|
|
|
REMOTE_REPO="${REGISTRY}/${IMAGE_NAME}"
|
|
|
|
|
fi
|
|
|
|
|
|
2026-06-29 21:56:12 -05:00
|
|
|
LOCAL_TAG="${IMAGE_NAME}:${VERSION}"
|
2026-06-29 22:03:58 -05:00
|
|
|
REMOTE_TAG="${REMOTE_REPO}:${VERSION}"
|
|
|
|
|
REMOTE_LATEST="${REMOTE_REPO}:latest"
|
2026-06-29 21:56:12 -05:00
|
|
|
|
|
|
|
|
echo "Tagging ${LOCAL_TAG} as ${REMOTE_TAG} ..."
|
|
|
|
|
docker tag "${LOCAL_TAG}" "${REMOTE_TAG}"
|
|
|
|
|
docker tag "${LOCAL_TAG}" "${REMOTE_LATEST}"
|
|
|
|
|
|
|
|
|
|
echo "Pushing ${REMOTE_TAG} ..."
|
|
|
|
|
docker push "${REMOTE_TAG}"
|
|
|
|
|
docker push "${REMOTE_LATEST}"
|
|
|
|
|
|
|
|
|
|
echo "Published: ${REMOTE_TAG}"
|