From e17d57e88e1ba52dde68c9c26fce094ede0622ac Mon Sep 17 00:00:00 2001 From: Eric Harding Date: Sun, 25 Oct 2026 15:42:24 -0400 Subject: [PATCH] Replace build-and-tag.sh with uniform build script; set version.txt to v8 Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_016CfGMAJK5sD43otMxjBYEy --- build | 16 ++++++++++++++++ build-and-tag.sh | 28 ---------------------------- version.txt | 2 +- 3 files changed, 17 insertions(+), 29 deletions(-) create mode 100755 build delete mode 100755 build-and-tag.sh diff --git a/build b/build new file mode 100755 index 0000000..1256ee6 --- /dev/null +++ b/build @@ -0,0 +1,16 @@ +#!/usr/bin/env bash +# Build the next versioned image, push it (+ :latest) to the registry, and +# record the new version in version.txt. Usage: ./build +set -euo pipefail + +cd "$(dirname "$(realpath "${BASH_SOURCE[0]}")")" + +IMAGE=registry.digitalsorcery.net/hardings-service +NEXT="v$(($(tr -d 'v[:space:]' < version.txt) + 1))" + +podman build --pull=always -t "$IMAGE:$NEXT" -t "$IMAGE:latest" . +podman push "$IMAGE:$NEXT" +podman push "$IMAGE:latest" +echo "$NEXT" > version.txt + +echo "Pushed $IMAGE:$NEXT" diff --git a/build-and-tag.sh b/build-and-tag.sh deleted file mode 100755 index 823fb3a..0000000 --- a/build-and-tag.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env bash -# Build the container image and tag it for the registry. -# Usage: ./build-and-tag.sh # reads version.txt, increments, builds, pushes -# Usage: ./build-and-tag.sh # explicit tag (e.g. ./build-and-tag.sh v6) -set -e - -IMAGE=hardings-service -REGISTRY=registry.digitalsorcery.net -VERSION_FILE="$(dirname "$0")/version.txt" - -if [ -n "$1" ]; then - TAG="$1" -else - # Read current version, increment the numeric portion - CURRENT=$(cat "$VERSION_FILE" | tr -d '[:space:]') - NUM=$(echo "$CURRENT" | sed 's/v//') - TAG="v$((NUM + 1))" -fi - -echo "Building ${IMAGE}:${TAG} ..." -podman build -t "${IMAGE}:${TAG}" -f Containerfile . -podman tag "${IMAGE}:${TAG}" "${REGISTRY}/${IMAGE}:${TAG}" -podman push "${REGISTRY}/${IMAGE}:${TAG}" - -# Update version.txt to match the tag we just pushed -echo "$TAG" > "$VERSION_FILE" - -echo "Done. ${REGISTRY}/${IMAGE}:${TAG} pushed." diff --git a/version.txt b/version.txt index 02a819f..a00f43e 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -v7 +v8