12e6135042
CI Smoke / toolchain (push) Successful in 1s
- publish-image.sh: add REGISTRY_NAMESPACE for Gitea Container Registry path - sample workflows: run docker login/build/push on host label (bundled docker CLI + mounted socket); fix doubled image path in build/push sample - docs: record v0.1.0 publish and remaining secret-gated push validation Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
37 lines
1.1 KiB
Bash
Executable File
37 lines
1.1 KiB
Bash
Executable File
#!/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}"
|
|
# 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}"
|
|
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
|
|
|
|
# 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
|
|
|
|
LOCAL_TAG="${IMAGE_NAME}:${VERSION}"
|
|
REMOTE_TAG="${REMOTE_REPO}:${VERSION}"
|
|
REMOTE_LATEST="${REMOTE_REPO}:latest"
|
|
|
|
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}"
|