Preserve upload order

This commit is contained in:
Richard Davison 2024-08-26 10:10:32 +02:00 committed by GitHub
parent 9a28f2423f
commit 1d3c3ef56a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -74,8 +74,8 @@ async function run() {
} }
} }
const currentAssets = rel.assets; const currentAssets = rel.assets;
const assets = await Promise.all(
files.map(async (path) => { const uploadFile = async (path) => {
const json = await upload( const json = await upload(
config, config,
gh, gh,
@ -85,10 +85,17 @@ async function run() {
); );
delete json.uploader; delete json.uploader;
return json; return json;
}), };
).catch((error) => {
throw error; let assets;
}); if (config.preserve_order) {
assets = await Promise.all(files.map(uploadFile));
} else {
assets = [];
for (const path of files) {
assets.push(await uploadFile(path));
}
}
setOutput("assets", assets); setOutput("assets", assets);
} }
console.log(`🎉 Release ready at ${rel.html_url}`); console.log(`🎉 Release ready at ${rel.html_url}`);