#!/bin/bash set -euo pipefail ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" cd "$ROOT" source "$ROOT/tools/release-lib.sh" # The version is always said out loud. # # With only three parts there was one obvious next number. With four # there are two — 0.2.6 is followed by 0.2.6.1 if it is a fix and by # 0.2.7 if it is not — and which one a release is, is a decision about # what is in it, not arithmetic. if [[ $# -ne 1 ]]; then current="$(release_channel_version canary || true)" echo "Usage: $0 VERSION" >&2 echo >&2 echo "Canary is on ${current:-an unknown version}. Name the release, for example:" >&2 if [[ -n "$current" ]] && release_version_valid "$current"; then IFS='.' read -r major minor patch maintenance <<< "$current" echo " $0 ${major}.${minor}.${patch}.$(( ${maintenance:-0} + 1 )) a maintenance release" >&2 echo " $0 ${major}.${minor}.$(( patch + 1 )) the next feature release" >&2 fi exit 2 fi version="$1" package_name="$(release_package_name "$version")" package_path="$ROOT/dist/$package_name" echo "Current canary: $(release_channel_version canary || echo unknown)" echo "New canary: $version" echo # Before anything is built: a version that has been published, or that # would not be newer than everything that has been, stops here. release_check_new_version "$version" "$ROOT/tools/build-release.sh" "$version" # Validate the exact artifact that will be published. If a previous canary is # available locally, exercise the real upgrade path as well as a fresh install. validation_args=("$package_path") if [[ -f "$RELEASE_LOCAL/canary/manifest.json" ]]; then previous_package_name="$(python3 -c \ 'import json, sys; print(json.load(open(sys.argv[1]))["package"].rsplit("/", 1)[-1])' \ "$RELEASE_LOCAL/canary/manifest.json")" previous_package="$RELEASE_LOCAL/packages/$previous_package_name" if [[ -f "$previous_package" && "$previous_package" != "$package_path" ]]; then validation_args+=("$previous_package") fi fi "$ROOT/tools/validate-trixie-release.sh" "${validation_args[@]}" # And the stable rooms' own path, on the same file. Every canary is a # stable release in waiting, and the desktops are not on the previous # canary: they are on whatever stable names, which can be several # releases back (0.2.2 under 0.2.6.1). A package that upgrades the # laptop and breaks the desktops has to fail here, not on a Sunday. if [[ -f "$RELEASE_LOCAL/stable/manifest.json" ]]; then stable_package_name="$(python3 -c \ 'import json, sys; print(json.load(open(sys.argv[1]))["package"].rsplit("/", 1)[-1])' \ "$RELEASE_LOCAL/stable/manifest.json")" stable_package="$RELEASE_LOCAL/packages/$stable_package_name" if [[ -f "$stable_package" && "$stable_package" != "${validation_args[1]:-}" ]]; then echo echo "Rehearsing the stable rooms' upgrade from $stable_package_name" VALIDATION_CHANNEL=stable \ "$ROOT/tools/validate-trixie-release.sh" "$package_path" "$stable_package" fi fi # Checked again after the gate, which takes long enough for somebody else # to have published in the meantime. release_check_new_version "$version" hash="$(sha256sum "$package_path" | awk '{print $1}')" mkdir -p "$RELEASE_LOCAL/packages" cp -n "$package_path" "$RELEASE_LOCAL/packages/$package_name" echo echo "Publishing package..." release_upload_package "$RELEASE_LOCAL/packages/$package_name" echo echo "Publishing canary manifest..." release_publish_manifest canary "$version" "$hash" echo "$RELEASE_URL/canary/latest.deb -> $package_name" echo echo "Checking what a classroom will see..." release_verify_channel canary "$version" echo " stable is still on $(release_channel_version stable || echo unknown)" echo echo "Published Ekklesia Classroom $version to CANARY" echo "$RELEASE_URL/canary/manifest.json"