#!/bin/bash set -euo pipefail # Publish a build to the classroom-v2 channel. # # The v2 rooms are on a channel of their own, and classroom-migrate moves # a machine onto it as soon as it takes this package: stable and canary # are both the sway line, and a v2 room left on either is handed the old # desktop back by the next release there. # # Nothing here can touch stable or canary. It writes one manifest, in one # directory, named after the one channel this file is about. # # ./update_classroom_v2.sh 0.1.48 # # The package goes up first and the manifest last, so a room that checks # for an update in the middle of a publish is offered nothing rather than # a manifest pointing at a file that is not there yet. ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" cd "$ROOT" CHANNEL=classroom-v2 if [[ $# -ne 1 ]]; then echo "Usage: $0 VERSION" echo "For example: $0 0.1.48" exit 1 fi version="$1" if [[ ! "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then echo "Invalid version: $version" exit 1 fi package_name="ekklesia-classroom_${version}_amd64.deb" package_path="$ROOT/dist/$package_name" if [[ ! -f "$package_path" ]]; then echo "No such package: $package_path" echo "Build it first: tools/build-release.sh $version" exit 1 fi echo "Publishing $version to $CHANNEL" echo # The same gate canary uses, against the exact artifact being published. validation_args=("$package_path") if [[ -f "$ROOT/repo/$CHANNEL/manifest.json" ]]; then previous_name="$(python3 -c \ "import json; print(json.load(open('repo/$CHANNEL/manifest.json'))['package'].rsplit('/', 1)[-1])")" previous="$ROOT/repo/packages/$previous_name" if [[ -f "$previous" && "$previous" != "$package_path" ]]; then validation_args+=("$previous") fi fi "$ROOT/tools/validate-trixie-release.sh" "${validation_args[@]}" hash="$(sha256sum "$package_path" | awk '{print $1}')" mkdir -p "$ROOT/repo/packages" "$ROOT/repo/$CHANNEL" cp "$package_path" "$ROOT/repo/packages/$package_name" cat > "$ROOT/repo/$CHANNEL/manifest.json" <