pontentially fixed auto update

This commit is contained in:
2026-11-07 11:20:42 -08:00
parent 8abcdf2c16
commit 8a6c515601

View File

@@ -137,18 +137,22 @@ function createGitLabRelease(tag, releaseLinks) {
console.log(`[CI Sync] Release ${tag} already exists. Appending our OS-specific files to it...`);
let promiseChain = Promise.resolve();
const linksPath = `/api/v4/projects/${PROJECT_ID}/releases/${encodeURIComponent(tag)}/assets/links`;
const hasInstaller = releaseLinks.some((l) => l.link_type === 'package');
for (const link of releaseLinks) {
promiseChain = promiseChain.then(() => {
return sendRequest('POST', `/api/v4/projects/${PROJECT_ID}/releases/${encodeURIComponent(tag)}/assets/links`, {
promiseChain = promiseChain.then(async () => {
const current = await sendRequest('GET', linksPath);
const clash = (Array.isArray(current) ? current : []).find((l) => l.name === link.name);
if (clash && link.name === 'manifest.json' && hasInstaller) {
await sendRequest('DELETE', `${linksPath}/${clash.id}`);
} else if (clash) {
console.log(`[CI Sync] Asset link '${link.name}' is already attached. Skipping.`);
return;
}
await sendRequest('POST', linksPath, {
name: link.name,
url: link.url,
link_type: link.link_type
}).catch(e => {
if (e.message.includes('already been taken') || e.message.includes('HTTP 409') || e.message.includes('HTTP 400')) {
console.log(`[CI Sync] Asset link '${link.name}' is already attached. Skipping.`);
return Promise.resolve();
}
throw e;
});
});
}