From badbd8f0f7df491a147631bdf6a8bc188147ca74 Mon Sep 17 00:00:00 2001 From: enki Date: Sat, 11 Jul 2026 09:36:14 -0700 Subject: [PATCH] release script: require the tag to exist before creating a release MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Letting the release API auto-create the tag leaves a forge-only tag the push-mirror prunes on its next sync — and Forgejo demotes the release to a hidden draft when its tag disappears (this made v1.0.2 vanish from the releases page overnight). Fail with instructions instead. Co-Authored-By: Claude Fable 5 --- apps/desktop/scripts/release-codeberg.mjs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/apps/desktop/scripts/release-codeberg.mjs b/apps/desktop/scripts/release-codeberg.mjs index 0f07064791..f731925afd 100644 --- a/apps/desktop/scripts/release-codeberg.mjs +++ b/apps/desktop/scripts/release-codeberg.mjs @@ -57,6 +57,17 @@ async function api(path, init = {}) { async function getOrCreateRelease(tagName, { prerelease = false } = {}) { let res = await api(`/repos/${OWNER}/${REPO}/releases/tags/${encodeURIComponent(tagName)}`); if (res.status === 404) { + // The tag MUST already exist on the forge, arriving via the git.utn.lol + // push-mirror. If we let the release API auto-create it, the next mirror + // sync prunes the forge-only tag and Forgejo silently demotes the release + // to a hidden draft (this ate v1.0.2's release page overnight). + const tagRes = await api(`/repos/${OWNER}/${REPO}/tags/${encodeURIComponent(tagName)}`); + if (tagRes.status === 404) { + throw new Error( + `Tag ${tagName} not found on ${OWNER}/${REPO}. Push it to the source repo first ` + + `(git push origin ${tagName}) and wait for the mirror to sync.`, + ); + } res = await api(`/repos/${OWNER}/${REPO}/releases`, { method: "POST", headers: { "Content-Type": "application/json" },