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
43
44
45
46
|
#!/usr/bin/env bash
# Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE
#
# local-ci-06-promote.sh — a published prerelease becomes a release.
#
# ./local-ci-06-promote.sh # the TAG of .release.env
# ./local-ci-06-promote.sh v1.0.5 # another published prerelease
#
# Only the "pre-release" label goes: the files, the notes and the tag stay as
# they are. On Rickub a published prerelease is already /releases/latest, so
# downloads should not change. It asks you to type the tag first.
source "$(dirname "$0")/local-ci-00-common.sh"
load_token
TAG="${1:-${TAG}}"
id="$(release_field id)"
[ -n "${id}" ] || { echo "❌ no release ${TAG}"; exit 1; }
[ "$(release_field draft)" = "false" ] || { echo "❌ ${TAG} is still a draft: run local-ci-05-publish.sh first"; exit 1; }
[ "$(release_field prerelease)" = "true" ] || { echo "❌ ${TAG} is not a prerelease: nothing to do"; exit 1; }
echo "/releases/latest is now: $(latest_location)"
echo "Promoting removes the pre-release label from ${TAG}."
printf 'Type %s to promote: ' "${TAG}"
read -r answer || answer=""
[ "${answer}" = "${TAG}" ] || { echo "❌ not promoted"; exit 1; }
status="$(call PATCH "/releases/${id}" -H 'Content-Type: application/json' -d '{"prerelease": false}')"
[ "${status}" = "200" ] || { echo "❌ HTTP ${status}: $(cat "${work}/body")"; exit 1; }
# Read the release back rather than trusting the 200: a field the server
# ignores would answer 200 too.
prerelease="$(release_field prerelease)"
draft="$(release_field draft)"
if [ "${prerelease}" != "false" ] || [ "${draft}" != "false" ]; then
echo "❌ ${TAG} reads back as prerelease=${prerelease}, draft=${draft}"
exit 1
fi
location="$(latest_location)"
echo "/releases/latest -> ${location}"
case "${location}" in
*"/${TAG}") ;;
*) echo "⚠️ /releases/latest does not point at ${TAG}" ;;
esac
echo "✅ ${TAG} is a release"
|