ZDDC/release-image.sh
ZDDC 5960fbca91 chore(release): drop Woodpecker CI; release-image.sh is now canonical
Removes .woodpecker.yml and replaces the tag-triggered image publish flow
with a local-build-and-push script (release-image.sh).

Why: the CI added two indirections (Woodpecker dashboard, Codeberg secrets
config) that aren't worth the cost for a single-developer release flow.
When the previous release didn't show up in the package registry, "did
the release happen?" required checking three places (the git tag, the
CI dashboard, the registry); with local builds, success or failure is
visible in the developer's terminal immediately.

The cascade behavior is preserved: `sh release-image.sh 0.0.3` publishes
:0.0.3 :stable :beta :alpha just like the .woodpecker.yml job did. Beta
and alpha channels work identically (`sh release-image.sh 0.0.3-beta.1
beta` → :0.0.3-beta.1 :beta :alpha).

The git-tag convention stays (`zddc-server-vX.Y.Z`); now you tag *and*
run the script as two coordinated steps. AGENTS.md "Release tagging" and
zddc/README.md "Release Tagging" / "Container image" updated to reflect
the new flow. No code change in the binary.

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

94 lines
3.1 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> [stable|beta|alpha]
#
# stable → :<version> :stable :beta :alpha (default)
# beta → :<version> :beta :alpha
# alpha → :<version> :alpha
#
# Examples:
# sh release-image.sh 0.0.3 # → :0.0.3 :stable :beta :alpha
# sh release-image.sh 0.0.3-beta.1 beta # → :0.0.3-beta.1 :beta :alpha
# sh release-image.sh 0.0.3-alpha.2 alpha # → :0.0.3-alpha.2 :alpha
#
# Convention: cut a git tag first (`git tag zddc-server-v0.0.3 && git push
# origin zddc-server-v0.0.3`) 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> [stable|beta|alpha]" >&2
echo " version: e.g. 0.0.3, 0.0.3-beta.1, 0.0.3-alpha.2" >&2
exit 1
}
[ $# -ge 1 ] || usage
VERSION="$1"
CHANNEL="${2:-stable}"
case "$CHANNEL" in
stable) TAGS="$VERSION stable beta alpha" ;;
beta) TAGS="$VERSION beta alpha" ;;
alpha) TAGS="$VERSION alpha" ;;
*) echo "error: unknown channel: $CHANNEL (expected stable|beta|alpha)" >&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."