-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathcreate-release-branch.js
More file actions
46 lines (36 loc) · 1.24 KB
/
create-release-branch.js
File metadata and controls
46 lines (36 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
const [from, to] = [process.argv[2], process.argv[3]];
if (!from || !to) {
console.error(`Invalid 'from' or 'to' version: '${from}', '${to}'`);
process.exit(1);
}
(async () => {
const { replaceInFileSync } = await import("replace-in-file");
const { simpleGit } = await import("simple-git");
const { execSync } = await import("child_process");
const paths = [
"sdk/go/project.json",
"sdk/python/pyproject.toml",
"sdk/typescript/package.json",
"sdk/ruby/lib/buildkite/version.rb",
"sdk/ruby/project.json",
"sdk/csharp/src/Buildkite.Sdk/Buildkite.Sdk.csproj",
];
const git = simpleGit();
const branch = `release/v${to}`;
await git.checkoutLocalBranch(branch);
// Bump versions.
replaceInFileSync({
files: paths,
from,
to,
});
// Build all SDKs.
execSync("npm run build", { stdio: "inherit" });
// Commit and tag.
await git.add("sdk"); // Include everything here, as lockfiles will also have changed.
await git.add("project.json"); // As this contains the new version.
await git.commit(`Release v${to}`);
// Push the commit.
await git.push("origin", branch);
console.log("Release branch created");
})();