react-native-macos/.ado/gitTagRelease.js

49 строки
1.6 KiB
JavaScript
Исходник Обычный вид История

// @ts-check
// Used to apply the package updates: the git tag for the published release.
2019-03-08 01:57:21 +03:00
const fs = require("fs");
const path = require("path");
const execSync = require("child_process").execSync;
const {pkgJsonPath, publishBranchName, gatherVersionInfo} = require('./versionUtils');
2019-03-08 01:57:21 +03:00
function exec(command) {
try {
console.log(`Running command: ${command}`);
return execSync(command, {
stdio: "inherit"
});
} catch (err) {
process.exitCode = 1;
console.log(`Failure running: ${command}`);
throw err;
}
}
function doPublish() {
2019-05-01 20:17:27 +03:00
console.log(`Target branch to publish to: ${publishBranchName}`);
2019-03-08 01:57:21 +03:00
const {releaseVersion, branchVersionSuffix} = gatherVersionInfo()
2019-03-08 01:57:21 +03:00
const tempPublishBranch = `publish-temp-${Date.now()}`;
2019-03-08 01:57:21 +03:00
exec(`git checkout -b ${tempPublishBranch}`);
2019-08-02 21:00:52 +03:00
exec(`git config --global user.email "53619745+rnbot@users.noreply.github.com"`);
exec(`git config --global user.name "React-Native Bot"`);
2019-07-30 23:03:00 +03:00
2019-03-08 01:57:21 +03:00
exec(`git add ${pkgJsonPath}`);
exec(`git commit -m "Applying package update to ${releaseVersion} ***NO_CI***"`);
2019-03-08 01:57:21 +03:00
exec(`git tag v${releaseVersion}`);
exec(`git push origin HEAD:${tempPublishBranch} --follow-tags --verbose`);
exec(`git push origin tag v${releaseVersion}`);
exec(`git checkout ${publishBranchName}`);
exec(`git pull origin ${publishBranchName}`);
exec(`git merge ${tempPublishBranch} --no-edit`);
exec(
`git push origin HEAD:${publishBranchName} --follow-tags --verbose`
2019-03-08 01:57:21 +03:00
);
exec(`git branch -d ${tempPublishBranch}`);
exec(`git push origin --delete -d ${tempPublishBranch}`);
2019-03-08 01:57:21 +03:00
}
doPublish();