mirror of
https://gitlab.com/vyla-entertainment/home.git
synced 2026-11-09 19:57:20 -05:00
pontentially fixed auto update
This commit is contained in:
20
release.js
20
release.js
@@ -137,18 +137,22 @@ function createGitLabRelease(tag, releaseLinks) {
|
|||||||
console.log(`[CI Sync] Release ${tag} already exists. Appending our OS-specific files to it...`);
|
console.log(`[CI Sync] Release ${tag} already exists. Appending our OS-specific files to it...`);
|
||||||
let promiseChain = Promise.resolve();
|
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) {
|
for (const link of releaseLinks) {
|
||||||
promiseChain = promiseChain.then(() => {
|
promiseChain = promiseChain.then(async () => {
|
||||||
return sendRequest('POST', `/api/v4/projects/${PROJECT_ID}/releases/${encodeURIComponent(tag)}/assets/links`, {
|
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,
|
name: link.name,
|
||||||
url: link.url,
|
url: link.url,
|
||||||
link_type: link.link_type
|
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;
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user