Compare commits

..

1 Commits

Author SHA1 Message Date
Louis Lam
75f5774d43 Update to 2.0.0-beta.4 2025-09-05 12:32:31 +08:00
5 changed files with 29 additions and 21 deletions

View File

@@ -24,7 +24,9 @@ if (! exists) {
// Also update package-lock.json
const npm = /^win/.test(process.platform) ? "npm.cmd" : "npm";
childProcess.spawnSync(npm, [ "install" ]);
commit(version);
tag(version);
} else {
console.log("version tag exists, please delete the tag or use another tag");
@@ -52,6 +54,19 @@ function commit(version) {
console.log(res.stdout.toString().trim());
}
/**
* Create a tag with the specified version
* @param {string} version Tag to create
* @returns {void}
*/
function tag(version) {
let res = childProcess.spawnSync("git", [ "tag", version ]);
console.log(res.stdout.toString().trim());
res = childProcess.spawnSync("git", [ "push", "origin", version ]);
console.log(res.stdout.toString().trim());
}
/**
* Check if a tag exists for the specified version
* @param {string} version Version to check

View File

@@ -8,7 +8,7 @@ import {
checkVersionFormat,
getRepoNames,
pressAnyKey,
execSync, uploadArtifacts, checkReleaseBranch,
execSync, uploadArtifacts,
} from "./lib.mjs";
import semver from "semver";
@@ -23,9 +23,6 @@ if (!githubToken) {
process.exit(1);
}
// Check if the current branch is "release"
checkReleaseBranch();
// Check if the version is a valid semver
checkVersionFormat(version);

View File

@@ -7,7 +7,7 @@ import {
checkTagExists,
checkVersionFormat,
getRepoNames,
pressAnyKey, execSync, uploadArtifacts, checkReleaseBranch
pressAnyKey, execSync, uploadArtifacts
} from "./lib.mjs";
const repoNames = getRepoNames();
@@ -21,9 +21,6 @@ if (!githubToken) {
process.exit(1);
}
// Check if the current branch is "release"
checkReleaseBranch();
// Check if the version is a valid semver
checkVersionFormat(version);

View File

@@ -249,16 +249,3 @@ export function execSync(cmd) {
console.info(`[DRY RUN] ${cmd}`);
}
}
/**
* Check if the current branch is "release"
* @returns {void}
*/
export function checkReleaseBranch() {
const res = childProcess.spawnSync("git", [ "rev-parse", "--abbrev-ref", "HEAD" ]);
const branch = res.stdout.toString().trim();
if (branch !== "release") {
console.error(`Current branch is ${branch}, please switch to "release" branch`);
process.exit(1);
}
}

View File

@@ -28,7 +28,9 @@ if (! exists) {
// Also update package-lock.json
const npm = /^win/.test(process.platform) ? "npm.cmd" : "npm";
childProcess.spawnSync(npm, [ "install" ]);
commit(newVersion);
tag(newVersion);
} else {
console.log("version exists");
@@ -52,6 +54,16 @@ function commit(version) {
}
}
/**
* Create a tag with the specified version
* @param {string} version Tag to create
* @returns {void}
*/
function tag(version) {
let res = childProcess.spawnSync("git", [ "tag", version ]);
console.log(res.stdout.toString().trim());
}
/**
* Check if a tag exists for the specified version
* @param {string} version Version to check