Add parameter to control version script (#23)

* Add version script

* Run build

Co-authored-by: mitchellhamilton <mitchell@hamil.town>
This commit is contained in:
Luis Herranz
2020-04-15 06:56:31 +10:00
committed by GitHub
co-authored by mitchellhamilton
parent 65b9570cef
commit d6b65536ef
3 changed files with 67 additions and 19 deletions
+15 -7
View File
@@ -59,6 +59,7 @@ import readChangesets from "@changesets/read";
let hasChangesets = changesets.length !== 0;
let publishScript = core.getInput("publish");
let versionScript = core.getInput("version");
if (!hasChangesets && !publishScript) {
console.log("No changesets found");
@@ -164,13 +165,20 @@ import readChangesets from "@changesets/read";
}
await exec("git", ["reset", "--hard", github.context.sha]);
let changesetsCliPkgJson = await fs.readJson(
path.join("node_modules", "@changesets", "cli", "package.json")
);
let cmd = semver.lt(changesetsCliPkgJson.version, "2.0.0")
? "bump"
: "version";
await exec("node", ["./node_modules/@changesets/cli/bin.js", cmd]);
if (versionScript) {
let [versionCommand, ...versionArgs] = versionScript.split(/\s+/);
await exec(versionCommand, versionArgs);
} else {
let changesetsCliPkgJson = await fs.readJson(
path.join("node_modules", "@changesets", "cli", "package.json")
);
let cmd = semver.lt(changesetsCliPkgJson.version, "2.0.0")
? "bump"
: "version";
await exec("node", ["./node_modules/@changesets/cli/bin.js", cmd]);
}
let searchQuery = `repo:${repo}+state:open+head:${versionBranch}+base:${branch}`;
let searchResultPromise = octokit.search.issuesAndPullRequests({
q: searchQuery