Skip to content

Commit

Permalink
ci(Nightly): Automatically delete old releases
Browse files Browse the repository at this point in the history
  • Loading branch information
Belphemur committed Oct 14, 2021
1 parent aef15b7 commit 475a540
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
13 changes: 11 additions & 2 deletions devRelease.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,20 @@ async function main() {

const fileBasename = path.basename(filePath);

const zipResponse = await bucket.upload(filePath, `nightly/${fileBasename}`);

const nightlyPrefix = "nightly/";
const list = (await bucket.list(nightlyPrefix)).sort((a, b) => a.timestamp > b.timestamp ? 1 : -1);

if(list.length >= 9) {
await bucket.removeFile(list[0]);
}

const zipResponse = await bucket.upload(filePath, `${nightlyPrefix}${fileBasename}`);

const versionData = {latest: version, published: new Date(), url: zipResponse.url};
await writeFile("version.json", JSON.stringify(versionData));
const currentVersionResponse = await bucket.upload("version.json", "nightly/version.json");
const currentVersionResponse = await bucket.upload("version.json", `${nightlyPrefix}version.json`);


const hook = new Webhook(webhookUrl);
const embed = new MessageBuilder()
Expand Down
11 changes: 5 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,12 @@
"@semantic-release/git": "^10.0.0",
"@semantic-release/github": "^8.0.1",
"@semantic-release/release-notes-generator": "^10.0.2",
"backblaze": "^2.3.0",
"conventional-changelog-conventionalcommits": "^4.6.1",
"discord-webhook-node": "^1.1.8",
"normalize-url": ">=7.0.2",
"semantic-release": "^18.0.0",
"trim-newlines": ">=3.0.1"
"trim-newlines": ">=3.0.1",
"backblaze": "github:belphemur/backblaze#master"

}
}

0 comments on commit 475a540

Please sign in to comment.