Remove stale assets
This commit is contained in:
parent
273ca2f537
commit
ccab9b0e84
20
.github/actions/github-release/main.js
vendored
20
.github/actions/github-release/main.js
vendored
@ -108,20 +108,20 @@ async function runOnce() {
|
|||||||
}
|
}
|
||||||
console.log("found release: ", JSON.stringify(release.data, null, 2));
|
console.log("found release: ", JSON.stringify(release.data, null, 2));
|
||||||
|
|
||||||
|
// Delete all assets from a previous run
|
||||||
|
for (const asset of release.data.assets) {
|
||||||
|
console.log(`deleting prior asset ${asset.id}`);
|
||||||
|
await octokit.rest.repos.deleteReleaseAsset({
|
||||||
|
owner,
|
||||||
|
repo,
|
||||||
|
asset_id: asset.id,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Upload all the relevant assets for this release as just general blobs.
|
// Upload all the relevant assets for this release as just general blobs.
|
||||||
for (const file of glob.sync(files)) {
|
for (const file of glob.sync(files)) {
|
||||||
const size = fs.statSync(file).size;
|
const size = fs.statSync(file).size;
|
||||||
const name = path.basename(file);
|
const name = path.basename(file);
|
||||||
for (const asset of release.data.assets) {
|
|
||||||
if (asset.name !== name)
|
|
||||||
continue;
|
|
||||||
console.log(`deleting prior asset ${asset.id}`);
|
|
||||||
await octokit.rest.repos.deleteReleaseAsset({
|
|
||||||
owner,
|
|
||||||
repo,
|
|
||||||
asset_id: asset.id,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
core.info(`upload ${file}`);
|
core.info(`upload ${file}`);
|
||||||
await octokit.rest.repos.uploadReleaseAsset({
|
await octokit.rest.repos.uploadReleaseAsset({
|
||||||
data: fs.createReadStream(file),
|
data: fs.createReadStream(file),
|
||||||
|
Loading…
Reference in New Issue
Block a user