#!/bin/bash set -euo pipefail ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" cd "$ROOT" source "$ROOT/tools/release-lib.sh" # Stable never gets a package of its own. It is pointed at one canary # already published, so the file every classroom downloads is byte for # byte the one the canary machine ran. if [[ $# -eq 1 ]]; then version="$1" else if [[ ! -f "$RELEASE_LOCAL/canary/manifest.json" ]]; then echo "No local canary manifest exists." exit 1 fi version="$(python3 -c \ 'import json, sys; print(json.load(open(sys.argv[1]))["version"])' \ "$RELEASE_LOCAL/canary/manifest.json")" fi release_require_version "$version" package_name="$(release_package_name "$version")" package_path="$RELEASE_LOCAL/packages/$package_name" if [[ ! -f "$package_path" ]]; then echo "Package does not exist locally:" echo "$package_path" exit 1 fi if [[ "$(release_package_version "$package_path")" != "$version" ]]; then echo "$package_name says it is $(release_package_version "$package_path")." >&2 exit 1 fi # A classroom only ever installs a version newer than its own, so a stable # manifest that went backwards would reach nobody and would only make the # channel say something untrue. current="$(release_channel_version stable || true)" if [[ -n "$current" ]] && ! release_version_gt "$version" "$current"; then echo "Stable is on $current; $version is not newer." >&2 exit 1 fi hash="$(sha256sum "$package_path" | awk '{print $1}')" echo "Promoting $version to STABLE (from ${current:-nothing})" # Refuses unless the server already holds exactly this package. release_publish_manifest stable "$version" "$hash" echo "$RELEASE_URL/stable/latest.deb -> $package_name" echo release_verify_channel stable "$version" echo echo "Ekklesia Classroom $version is now STABLE" echo "$RELEASE_URL/stable/manifest.json"