Skip to content

Commit

Permalink
Improve update script
Browse files Browse the repository at this point in the history
  • Loading branch information
dsherret committed Jan 13, 2024
1 parent dd89340 commit 5762f05
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion deno.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"imports": {
"automation": "https://raw.githubusercontent.com/dprint/automation/0.8.1/mod.ts",
"automation": "https://raw.githubusercontent.com/dprint/automation/0.9.0/mod.ts",
"octokit": "npm:octokit@^3.1"
}
}
2 changes: 1 addition & 1 deletion scripts/generateReleaseNotes.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { generateChangeLog } from "https://raw.githubusercontent.com/dprint/automation/0.9.0/changelog.ts";
import { generateChangeLog } from "automation";

const version = Deno.args[0];
const changelog = await generateChangeLog({
Expand Down
12 changes: 9 additions & 3 deletions scripts/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ $.log("Found new version.");
$.logStep("Updating Cargo.toml...");
const isPatchBump = cargoTomlVersion.version.major === latestTag.version.major
&& cargoTomlVersion.version.minor === latestTag.version.minor;
cargoToml.bumpCargoTomlVersion(isPatchBump ? "patch" : "minor");
cargoToml.replaceAll(cargoTomlVersion.tag, latestTag.tag);

// run the tests
Expand All @@ -31,6 +30,13 @@ if (Deno.args.includes("--skip-publish")) {
Deno.exit(0);
}

$.logStep(`Committing Biome version bump commit...`);
await $`git add .`;
const message = `${isPatchBump ? "fix" : "feat"}: update to biome ${latestTag.tag}`;
await $`git commit -m ${message}`;

$.logStep("Bumping version in Cargo.toml...");
cargoToml.bumpCargoTomlVersion(isPatchBump ? "patch" : "minor");
// release
const newVersion = cargoToml.version();
$.logStep(`Committing and publishing ${newVersion}...`);
Expand Down Expand Up @@ -72,12 +78,12 @@ function tagToVersion(tag: string) {
return semver.parse(tag.replace(/^cli\/v/, ""));
}

async function getGitTags() {
async function getGitTags(): Promise<string[]> {
const client = new Octokit();
const response = await client.request("GET /repos/{owner}/{repo}/tags", {
owner: "biomejs",
repo: "biome",
per_page: 100,
});
return response.data.map((item) => item.name);
return response.data.map((item: { name: string }) => item.name);
}

0 comments on commit 5762f05

Please sign in to comment.