Skip to content

Commit

Permalink
ci: release script update
Browse files Browse the repository at this point in the history
  • Loading branch information
Ji Sang Seo committed Feb 17, 2024
1 parent f050a5d commit 6e16df1
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 77 deletions.
2 changes: 1 addition & 1 deletion .versionrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{
"type": "chore",
"section": "Others",
"hidden": false
"hidden": true
},
{
"type": "revert",
Expand Down
5 changes: 1 addition & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@
"omt-finish": "cli/oh-my-task-finish.mjs"
},
"scripts": {
"release": "standard-version",
"pub": "node ./versionManager.mjs",
"pub:major": "node ./versionManager.mjs --major",
"pub:minor": "node ./versionManager.mjs --minor",
"release": "node ./release.mjs",
"test": "echo \"Error: no test specified\" && exit 1",
"omt": "node ./cli/oh-my-task.mjs",
"omt-init": "node ./cli/oh-my-task-init.mjs",
Expand Down
34 changes: 34 additions & 0 deletions release.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { execSync } from "child_process";
import chalk from "chalk";

const RELEASE_CREDENTIAL_BRANCH = "main";

function validation() {
const result = {
success: true,
msg: "",
};
//1. should be main branch
const currentBranchName = execSync(`git branch --show-current`, {
encoding: "utf8",
}).trim();
if (currentBranchName !== RELEASE_CREDENTIAL_BRANCH) {
result.success = false;
result.msg = "current branch is not allowed to release";
}

return result;
}

async function exec() {
const res = validation();

if (!res.success) {
throw chalk.red(`Validation Error : ${res.msg}`);
}

execSync(`pnpm standard-version`);
execSync(`git push --follow-tags`);
}

exec();
72 changes: 0 additions & 72 deletions versionManager.mjs

This file was deleted.

0 comments on commit 6e16df1

Please sign in to comment.