8881241fd8
runs dist.sh inside that local image via a bind mount, andcupload-image.sh pushes the already-built image. The Dockerfile also warms the Gradle dependency cache in a throwaway build stage, and pre-installs the pinned CMake version, so `run-image.sh` doesn't re-download the same Maven dependencies on every run. dist.sh now strips the -pre+meta suffix before writing package.json's version, since Pebble's build tooling parses it strictly as X.Y.Z integers and was rejecting suffixed versions.
42 lines
1.4 KiB
Bash
Executable File
42 lines
1.4 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Pushes the build environment image — already built locally with
|
|
# ./build-image.sh, and ideally verified with ./run-image.sh — to
|
|
# cr.ladkau.de. The Gitea Actions release workflow pulls this image to
|
|
# run dist.sh.
|
|
set -euo pipefail
|
|
|
|
cd "$(dirname "${BASH_SOURCE[0]}")"
|
|
ROOT="$(pwd)"
|
|
|
|
fail() { echo "PREFLIGHT FAIL: $*" >&2; exit 1; }
|
|
|
|
command -v docker >/dev/null 2>&1 \
|
|
|| fail "docker not found in PATH"
|
|
|
|
[ -f "$ROOT/registry.env" ] \
|
|
|| fail "registry.env not found — copy registry.env.example to registry.env and fill in your cr.ladkau.de credentials"
|
|
|
|
# shellcheck disable=SC1091
|
|
source "$ROOT/registry.env"
|
|
|
|
: "${REGISTRY:?registry.env must set REGISTRY}"
|
|
: "${REGISTRY_IMAGE:?registry.env must set REGISTRY_IMAGE}"
|
|
: "${REGISTRY_USER:?registry.env must set REGISTRY_USER}"
|
|
: "${REGISTRY_PASSWORD:?registry.env must set REGISTRY_PASSWORD}"
|
|
|
|
VERSION="$(<"$ROOT/build-image/VERSION")"
|
|
[ -n "$VERSION" ] || fail "build-image/VERSION is empty"
|
|
|
|
docker image inspect "$REGISTRY_IMAGE:$VERSION" >/dev/null 2>&1 \
|
|
|| fail "$REGISTRY_IMAGE:$VERSION not found locally — run ./build-image.sh first"
|
|
|
|
echo "== Logging in to $REGISTRY =="
|
|
echo "$REGISTRY_PASSWORD" | docker login "$REGISTRY" -u "$REGISTRY_USER" --password-stdin
|
|
|
|
echo "== Pushing $REGISTRY_IMAGE:$VERSION and :latest =="
|
|
docker push "$REGISTRY_IMAGE:$VERSION"
|
|
docker push "$REGISTRY_IMAGE:latest"
|
|
|
|
echo "== Done =="
|
|
echo "Image: $REGISTRY_IMAGE:$VERSION"
|