Release 2.0.0-beta.4 (#6104)

pull/5948/head^2
Louis Lam 2025-09-05 12:55:03 +08:00 committed by GitHub
parent 0e30c43a80
commit c6048d56b4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 22 additions and 30 deletions

View File

@ -24,9 +24,7 @@ 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");
@ -54,19 +52,6 @@ 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,
execSync, uploadArtifacts, checkReleaseBranch,
} from "./lib.mjs";
import semver from "semver";
@ -23,6 +23,9 @@ 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
pressAnyKey, execSync, uploadArtifacts, checkReleaseBranch
} from "./lib.mjs";
const repoNames = getRepoNames();
@ -21,6 +21,9 @@ 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,3 +249,16 @@ 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,9 +28,7 @@ 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");
@ -54,16 +52,6 @@ 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

View File

@ -1,6 +1,6 @@
{
"name": "uptime-kuma",
"version": "2.0.0-beta.3",
"version": "2.0.0-beta.4",
"license": "MIT",
"repository": {
"type": "git",