1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
#!/usr/bin/env bash
# Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE
#
# local-ci-05-publish.sh — the draft becomes public, as a prerelease.
#
# On Rickub a published prerelease becomes /releases/latest, so everybody who
# downloads the latest version gets this one. It asks you to type the tag first,
# then downloads what is public and compares it with release/<TAG>/.
source "$(dirname "$0")/local-ci-00-common.sh"
load_token
[ -f "${assets_dir}/SHA256SUMS" ] || { echo "❌ no ${assets_dir}/SHA256SUMS: run local-ci-02-build.sh"; exit 2; }
id="$(release_field id)"
[ -n "${id}" ] || { echo "❌ no release ${TAG}: run local-ci-03-create-draft.sh"; exit 1; }
[ "$(release_field draft)" = "true" ] || { echo "❌ ${TAG} is already public"; exit 1; }
echo "/releases/latest is now: $(latest_location)"
echo "Publishing makes ${TAG} the latest version for everybody."
printf 'Type %s to publish: ' "${TAG}"
read -r answer || answer=""
[ "${answer}" = "${TAG}" ] || { echo "❌ not published"; exit 1; }
status="$(call PATCH "/releases/${id}" -H 'Content-Type: application/json' -d '{"draft": false, "prerelease": true}')"
[ "${status}" = "200" ] || { echo "❌ HTTP ${status}: $(cat "${work}/body")"; exit 1; }
echo "==> published"
echo "==> checking what is public"
mkdir -p "${work}/download"
curl -fsSL -m 60 "${web}/releases/download/${TAG}/SHA256SUMS" -o "${work}/download/SHA256SUMS"
cmp "${work}/download/SHA256SUMS" "${assets_dir}/SHA256SUMS" || { echo "❌ SHA256SUMS differs"; exit 1; }
while read -r _ name; do
curl -fsSL -m 300 "${web}/releases/download/${TAG}/${name}" -o "${work}/download/${name}"
done < "${assets_dir}/SHA256SUMS"
( cd "${work}/download" && sha256sum -c SHA256SUMS )
location="$(latest_location)"
echo "/releases/latest -> ${location}"
case "${location}" in
*"/${TAG}") ;;
*) echo "⚠️ /releases/latest does not point at ${TAG}" ;;
esac
echo "✅ ${TAG} is public"
|