mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
docs: update changelog (#7004)
This commit is contained in:
18
build/create-release-changelog-pr.js
Normal file
18
build/create-release-changelog-pr.js
Normal file
@@ -0,0 +1,18 @@
|
||||
const { readFileSync } = require("fs");
|
||||
const { resolve } = require("path");
|
||||
const { createPR, argsParser, gitBranch } = require("./pr-helper");
|
||||
|
||||
const currentBranch = argsParser().currentBranch || gitBranch;
|
||||
const modulesPackageVersion = argsParser().packageVersion || JSON.parse(readFileSync(resolve(process.cwd(), "tns-core-modules/package.json")).toString()).version;
|
||||
const title = argsParser().title || `release: cut the ${modulesPackageVersion} release`;
|
||||
const baseBranch = argsParser().base || "release";
|
||||
const body = argsParser().body || "docs: update changelog";
|
||||
|
||||
const postQuery = {
|
||||
"body": body,
|
||||
"head": currentBranch,
|
||||
"base": baseBranch,
|
||||
"title": title
|
||||
}
|
||||
|
||||
createPR(postQuery);
|
||||
9
build/merge-release-in-master-pr.js
Normal file
9
build/merge-release-in-master-pr.js
Normal file
@@ -0,0 +1,9 @@
|
||||
const { createPR, gitBranch } = require("./pr-helper");
|
||||
|
||||
const postQuery = {
|
||||
"head": gitBranch,
|
||||
"base": "master",
|
||||
"title": "chore: merge release in master"
|
||||
}
|
||||
|
||||
createPR(postQuery);
|
||||
39
build/pr-helper.js
Normal file
39
build/pr-helper.js
Normal file
@@ -0,0 +1,39 @@
|
||||
const { execSync } = require('child_process');
|
||||
const { writeFileSync, unlinkSync } = require("fs");
|
||||
const { resolve } = require("path");
|
||||
|
||||
exports.gitBranch = execSync("git branch").toString()
|
||||
.split("\n")
|
||||
.filter(f => f.trim().startsWith("*"))[0]
|
||||
.replace("*", "").trim();
|
||||
|
||||
exports.createPR = (postQuery) => {
|
||||
if (!process.env.GIT_TOKEN) {
|
||||
console.error("Missing env variable GIT_TOKEN");
|
||||
process.exit(1);
|
||||
}
|
||||
const releaseDataJsonPath = resolve(process.cwd(), "git-helper.json");
|
||||
writeFileSync(releaseDataJsonPath, JSON.stringify(postQuery));
|
||||
const result = execSync(` curl -d "@${releaseDataJsonPath}" -X POST https://api.github.com/repos/NativeScript/NativeScript/pulls -H "Authorization: token ${process.env.GIT_TOKEN}" `);
|
||||
console.log(result.toString());
|
||||
unlinkSync(releaseDataJsonPath);
|
||||
|
||||
const requesResultJson = JSON.parse(result);
|
||||
execSync(`open ${requesResultJson.html_url}`);
|
||||
|
||||
return requesResultJson;
|
||||
}
|
||||
|
||||
exports.argsParser = () => {
|
||||
args = {};
|
||||
process.argv
|
||||
.filter(a => a.startsWith("--"))
|
||||
.map(el => {
|
||||
el = el.split("=");
|
||||
const prop = el[0].replace("--", "").replace("-", "").trim();
|
||||
const value = el[1].trim();
|
||||
args[prop] = value;
|
||||
});
|
||||
|
||||
return args;
|
||||
}
|
||||
Reference in New Issue
Block a user