ZDDC/release-image.sh
ZDDC 40d9956e54 chore(release): default to alpha cascade; tidy stale CI references
- release-image.sh now defaults to alpha (was stable). Active dev no
  longer silently advances :stable; that tag only moves on a deliberate
  `sh release-image.sh <ver> stable`. Same cascade logic, reordered
  default. Updated AGENTS.md and zddc/README.md sections accordingly.
- zddc/Containerfile: dropped the "see .woodpecker.yml" comment since
  that file no longer exists; pointed the docs to release-image.sh.
- build.sh: dropped the "CI builds the runtime container directly"
  parenthetical; the cross-compiled host-binaries build is the only
  thing that step actually produces.

Why alpha as the default: caught it during active development —
:stable kept advancing every release because the script defaulted
there. Solo workflow + alpha default = `:stable` is a deliberate
gesture, not a side-effect.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-28 18:17:16 -05:00

100 lines
3.5 KiB
Bash
Executable file

#!/bin/sh
# release-image.sh — build the zddc-server runtime image locally and push it
# to codeberg.org/varasys/zddc-server with cascading channel tags.
#
# Usage:
# sh release-image.sh <version> [alpha|beta|stable]
#
# alpha → :<version> :alpha (default — for active dev)
# beta → :<version> :beta :alpha
# stable → :<version> :stable :beta :alpha
#
# Examples:
# sh release-image.sh 0.0.4 # → :0.0.4 :alpha (default)
# sh release-image.sh 0.0.4 beta # → :0.0.4 :beta :alpha
# sh release-image.sh 0.0.4 stable # → :0.0.4 :stable :beta :alpha
#
# Why alpha is the default: `:stable` should only advance on a deliberate
# promotion, not as a side-effect of every dev release. With alpha as
# default, `sh release-image.sh <version>` always lands on the alpha
# channel; the `:stable` tag stays put until you explicitly pass `stable`.
#
# Convention: cut a git tag first (`git tag zddc-server-v0.0.4 && git push
# origin zddc-server-v0.0.4`) so version history is auditable, then run this
# to publish the image. The two are coordinated by hand, deliberately —
# `.woodpecker.yml` is gone; this script is the canonical path.
#
# Prerequisites:
# - podman (or substitute docker — the commands below are identical)
# - logged in to codeberg.org: `podman login codeberg.org`
# (your Codeberg username + a personal token with `package:write` scope,
# generated at https://codeberg.org/user/settings/applications)
#
# What it does:
# 1. Runs `sh build.sh` so zddc/dist/web/{index.html,archive.html} reflect
# current source — those get COPYd into the runtime image.
# 2. Builds zddc/Containerfile's `server` stage as a single local image.
# 3. Tags that image with each cascade tag and pushes them in turn.
set -eu
usage() {
echo "usage: $0 <version> [alpha|beta|stable]" >&2
echo " channel default: alpha (active dev)" >&2
echo " version: e.g. 0.0.4, 0.0.4-beta.1, 0.0.4-alpha.2" >&2
exit 1
}
[ $# -ge 1 ] || usage
VERSION="$1"
CHANNEL="${2:-alpha}"
case "$CHANNEL" in
alpha) TAGS="$VERSION alpha" ;;
beta) TAGS="$VERSION beta alpha" ;;
stable) TAGS="$VERSION stable beta alpha" ;;
*) echo "error: unknown channel: $CHANNEL (expected alpha|beta|stable)" >&2; exit 1 ;;
esac
REPO="codeberg.org/varasys/zddc-server"
SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd)
# Pick podman or docker, whichever is on PATH.
if command -v podman >/dev/null 2>&1; then
OCI=podman
elif command -v docker >/dev/null 2>&1; then
OCI=docker
else
echo "error: neither podman nor docker found on PATH" >&2
exit 1
fi
echo "=== Building $REPO ==="
echo "Version: $VERSION"
echo "Channel: $CHANNEL"
echo "Tags: $TAGS"
echo "OCI CLI: $OCI"
echo
# Refresh dist/web — the Containerfile's server stage COPYs them in.
sh "$SCRIPT_DIR/build.sh"
# Build the runtime image as a single local tag, then re-tag for each cascade
# entry so the build runs once and the pushes are cheap layer reuses.
"$OCI" build --target server -t zddc-server:build "$SCRIPT_DIR/zddc/"
echo
echo "=== Pushing tags ==="
for tag in $TAGS; do
"$OCI" tag zddc-server:build "$REPO:$tag"
"$OCI" push "$REPO:$tag"
echo "pushed $REPO:$tag"
done
echo
echo "=== Done ==="
echo "Image is live at $REPO:$VERSION"
echo "Tags published: $TAGS"
echo
echo "Next: bump tnd-zddc-chart (push to develop) so the chart's CI rebuilds"
echo "the dev-shell image against the new :beta and helm-rolls the cluster."