release script: require the tag to exist before creating a release
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 <noreply@anthropic.com>
This commit is contained in:
@@ -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" },
|
||||
|
||||
Reference in New Issue
Block a user