From 7183ea1d671ab48c0651f27eed8e2980b0a844b1 Mon Sep 17 00:00:00 2001 From: Roman Buryan Date: Wed, 14 Oct 2026 16:48:45 +0300 Subject: [PATCH] =?UTF-8?q?chore(F6-7):=20=D1=81=D0=BA=D1=80=D0=B8=D0=BF?= =?UTF-8?q?=D1=82=20=D0=BE=D1=84=D0=BE=D1=80=D0=BC=D0=BB=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D1=8F=20=D0=B2=D1=8B=D0=BF=D1=83=D1=81=D0=BA=D0=B0=20=D0=BF?= =?UTF-8?q?=D0=BE=20=D1=82=D0=B5=D0=B3=D1=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ops/update-manager/create-release.sh | 62 ++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100755 ops/update-manager/create-release.sh diff --git a/ops/update-manager/create-release.sh b/ops/update-manager/create-release.sh new file mode 100755 index 0000000..54229c0 --- /dev/null +++ b/ops/update-manager/create-release.sh @@ -0,0 +1,62 @@ +#!/bin/bash +# ============================================================ +# create-release.sh — оформление выпуска в Gitea под тег v1.4 +# ============================================================ +# Описание берётся из самого тега, а не набирается заново: так выпуск +# и тег не разойдутся. +# +# Запуск: bash create-release.sh +# ============================================================ +set -uo pipefail + +cd /root/buryan-infra + +TOK=$(cat /root/.gitea_api) +REPO=agent-qwen/buryan-infra +TAG=v1.4 + +echo "=== 1. ЗАБИРАЮ ОПИСАНИЕ ИЗ ТЕГА ===" +git tag -l --format='%(contents:body)' "$TAG" > /root/tag-body.txt +lines=$(wc -l < /root/tag-body.txt) +echo "строк описания: $lines" +head -3 /root/tag-body.txt + +if [ "$lines" -lt 5 ]; then + echo "❌ описание тега пустое или слишком короткое — выпуск не создаю" + exit 1 +fi + +echo +echo "=== 2. СОБИРАЮ ТЕЛО ЗАПРОСА ===" +jq -n \ + --arg tag "$TAG" \ + --arg name 'Спринт F6: обновления и наблюдаемость' \ + --rawfile body /root/tag-body.txt \ + '{tag_name:$tag, name:$name, body:$body, draft:false, prerelease:false}' \ + > /tmp/release.json + +echo -n "размер тела запроса: "; wc -c < /tmp/release.json +jq -r '.tag_name + " / " + .name' /tmp/release.json + +echo +echo "=== 3. ОТПРАВЛЯЮ ===" +code=$(curl -s -X POST \ + -H "Authorization: token ${TOK}" \ + -H 'Content-Type: application/json' \ + --data-binary @/tmp/release.json \ + -o /root/rel-resp.json -w '%{http_code}' \ + "http://192.168.1.140:3000/api/v1/repos/${REPO}/releases") +echo "код ответа: $code" + +if [ "$code" = "201" ]; then + jq -r '"✅ выпуск создан: " + .html_url' /root/rel-resp.json +else + echo "ответ сервера:" + head -c 400 /root/rel-resp.json; echo +fi + +echo +echo "=== 4. ПРОВЕРКА ===" +curl -s -H "Authorization: token ${TOK}" \ + "http://192.168.1.140:3000/api/v1/repos/${REPO}/releases?limit=5" -o /root/rel-check.json +jq -r '.[] | [.tag_name, (.body | length | tostring)] | @tsv' /root/rel-check.json