From 6b900ccd9ebd33d3cb1a1e0dde02336088ab300d Mon Sep 17 00:00:00 2001 From: Dmitriy Fofanov Date: Wed, 25 Feb 2026 16:42:59 +0300 Subject: [PATCH] =?UTF-8?q?fix(release):=20=D0=B2=D1=81=D0=B5=D0=B3=D0=B4?= =?UTF-8?q?=D0=B0=20PATCH=20title+note=20=D0=B8=20concurrency=20=D0=B4?= =?UTF-8?q?=D0=BB=D1=8F=20=D0=B4=D0=B5=D0=B4=D1=83=D0=BF=D0=BB=D0=B8=D0=BA?= =?UTF-8?q?=D0=B0=D1=86=D0=B8=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Корневая причина пустых релизов: при workflow_dispatch + push тега запускались 2 параллельных run'а, один перезатирал body другого. - Всегда делаем PATCH после создания/нахождения релиза - concurrency group: release-{tag} с cancel-in-progress: true - Гарантирует что body будет записан независимо от race condition --- .github/workflows/release.yml | 40 ++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e2c8afa..c59eed3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,6 +13,10 @@ on: permissions: contents: write +concurrency: + group: release-${{ github.event.inputs.tag || github.ref_name }} + cancel-in-progress: true + env: DIST_DIR: dist @@ -340,7 +344,7 @@ jobs: rm -f /tmp/release_id.txt # If release already exists (e.g. Gitea auto-created it from tag push), - # find it and PATCH to update title + note + # find it by tag if [ -z "${RELEASE_ID}" ] && [ "${HOST}" != "github.com" ]; then echo ">>> Релиз не создан (возможно уже существует), ищем по тегу ${TAG}..." RELEASE_JSON=$(curl -sS \ @@ -351,22 +355,6 @@ jobs: RELEASE_ID=$(cat /tmp/release_id.txt) fi rm -f /tmp/release_id.txt - - # Update existing release with our generated title and note - if [ -n "${RELEASE_ID}" ]; then - echo ">>> Обновление существующего релиза (ID: ${RELEASE_ID}) — title + note..." - if [ "${HOST}" = "github.com" ]; then - PATCH_PAYLOAD="{\"name\":\"${RELEASE_TITLE}\",\"body\":${BODY_JSON}}" - else - PATCH_PAYLOAD="{\"title\":\"${RELEASE_TITLE}\",\"note\":${BODY_JSON}}" - fi - PATCH_RESP=$(curl -sS -X PATCH \ - -H "${AUTH_HEADER}" \ - -H "Content-Type: application/json" \ - "${SERVER}/api/v1/repos/${REPO}/releases/${RELEASE_ID}" \ - -d "${PATCH_PAYLOAD}") - echo ">>> Релиз обновлён" - fi fi if [ -z "${RELEASE_ID}" ]; then @@ -375,6 +363,24 @@ jobs: exit 1 fi + # Always PATCH the release to guarantee title + note are set + # (handles race condition when parallel run creates empty release) + echo ">>> Обновление релиза (ID: ${RELEASE_ID}) — title + note..." + if [ "${HOST}" = "github.com" ]; then + PATCH_PAYLOAD="{\"name\":\"${RELEASE_TITLE}\",\"body\":${BODY_JSON}}" + PATCH_URL="https://api.github.com/repos/${REPO}/releases/${RELEASE_ID}" + else + PATCH_PAYLOAD="{\"title\":\"${RELEASE_TITLE}\",\"note\":${BODY_JSON}}" + PATCH_URL="${SERVER}/api/v1/repos/${REPO}/releases/${RELEASE_ID}" + fi + PATCH_RESP=$(curl -sS -X PATCH \ + -H "${AUTH_HEADER}" \ + -H "Content-Type: application/json" \ + "${EXTRA_HEADERS[@]}" \ + "${PATCH_URL}" \ + -d "${PATCH_PAYLOAD}") + echo ">>> Релиз обновлён" + if [ "${HOST}" = "github.com" ]; then UPLOAD_BASE=$(printf '%s' "${RELEASE_JSON}" | python3 -c "import sys,json; print(json.load(sys.stdin).get('upload_url','').split('{')[0])") RELEASE_URL="https://github.com/${REPO}/releases/tag/${TAG}"