#!/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 [stable|beta|alpha] # # stable → : :stable :beta :alpha (default) # beta → : :beta :alpha # alpha → : :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 [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."