Add CI and manual image publishing workflows
- .gitea/workflows/ci.yml: on every push/PR, run Django checks + the full backend suite against MariaDB/Redis services and the frontend lint/type-check/build. Runs on the nitro-ci runner (ubuntu-latest). - .gitea/workflows/publish.yml: manual dispatch; multi-arch build+push of both images as :latest and :<short-sha> with GIT_HASH baked in. - push_*.sh: non-interactive registry login for CI (REGISTRY_USER/ REGISTRY_TOKEN) and a PLATFORMS override.
This commit is contained in:
@@ -10,10 +10,16 @@ REGISTRY="gitea.rainbow-herring.ts.net/jakebreath/j621-backend"
|
||||
REGISTRY_HOST="$(printf '%s' "$REGISTRY" | cut -d/ -f1)"
|
||||
SHA="${1:-$(git rev-parse --short HEAD)}"
|
||||
BUILDER=multiarch
|
||||
PLATFORMS="linux/amd64,linux/arm64"
|
||||
PLATFORMS="${PLATFORMS:-linux/amd64,linux/arm64}"
|
||||
|
||||
echo "==> Logging in to $REGISTRY_HOST ..."
|
||||
docker login "$REGISTRY_HOST"
|
||||
if [ -n "${REGISTRY_USER:-}" ] && [ -n "${REGISTRY_TOKEN:-}" ]; then
|
||||
# Non-interactive login for CI (workflow passes GITHUB_TOKEN).
|
||||
printf '%s' "$REGISTRY_TOKEN" | docker login "$REGISTRY_HOST" \
|
||||
-u "$REGISTRY_USER" --password-stdin
|
||||
else
|
||||
docker login "$REGISTRY_HOST"
|
||||
fi
|
||||
|
||||
if ! docker buildx inspect "$BUILDER" >/dev/null 2>&1; then
|
||||
echo "==> Creating buildx builder '$BUILDER' ..."
|
||||
|
||||
@@ -10,10 +10,16 @@ REGISTRY="gitea.rainbow-herring.ts.net/jakebreath/j621-frontend"
|
||||
REGISTRY_HOST="$(printf '%s' "$REGISTRY" | cut -d/ -f1)"
|
||||
SHA="${1:-$(git rev-parse --short HEAD)}"
|
||||
BUILDER=multiarch
|
||||
PLATFORMS="linux/amd64,linux/arm64"
|
||||
PLATFORMS="${PLATFORMS:-linux/amd64,linux/arm64}"
|
||||
|
||||
echo "==> Logging in to $REGISTRY_HOST ..."
|
||||
docker login "$REGISTRY_HOST"
|
||||
if [ -n "${REGISTRY_USER:-}" ] && [ -n "${REGISTRY_TOKEN:-}" ]; then
|
||||
# Non-interactive login for CI (workflow passes GITHUB_TOKEN).
|
||||
printf '%s' "$REGISTRY_TOKEN" | docker login "$REGISTRY_HOST" \
|
||||
-u "$REGISTRY_USER" --password-stdin
|
||||
else
|
||||
docker login "$REGISTRY_HOST"
|
||||
fi
|
||||
|
||||
if ! docker buildx inspect "$BUILDER" >/dev/null 2>&1; then
|
||||
echo "==> Creating buildx builder '$BUILDER' ..."
|
||||
|
||||
Reference in New Issue
Block a user