Compare commits

...

3 Commits

Author SHA1 Message Date
Copilot
16cce185fc chore: translate Chinese comments to English in bump-versions.ts (#7424)
* Initial plan

* chore: translate Chinese comments to English in bump-versions.ts

Co-authored-by: discord9 <55937128+discord9@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: discord9 <55937128+discord9@users.noreply.github.com>
2025-12-17 11:32:32 +08:00
discord9
35624ffdfe Merge branch 'main' into chore/manual_pre_release_docs 2025-12-17 11:05:42 +08:00
discord9
aab2c7343a chore: manually choose pre release docs?
Signed-off-by: discord9 <discord9@163.com>
2025-11-12 11:33:20 +08:00
3 changed files with 489 additions and 413 deletions

View File

@@ -15,6 +15,7 @@
*/
import * as core from "@actions/core";
import semver from "semver";
import {obtainClient} from "@/common";
interface RepoConfig {
@@ -57,18 +58,28 @@ const REPO_CONFIGS: Record<string, RepoConfig> = {
return ['bump-nightly-version.yml', version];
}
const parts = version.split('.');
if (parts.length !== 3) {
throw new Error('Invalid version format');
// Parse the version using semver library
const parsedVersion = semver.parse(version);
if (!parsedVersion) {
throw new Error(`Invalid semantic version format: ${version}`);
}
// If patch version (last number) is 0, it's a major version
// Return only major.minor version
if (parts[2] === '0') {
return ['bump-version.yml', `${parts[0]}.${parts[1]}`];
// If there is a pre-release identifier, throw an error for manual determination
if (parsedVersion.prerelease && parsedVersion.prerelease.length > 0) {
throw new Error(
`Pre-release version "${version}" requires manual determination of which workflow to use.\n` +
`Please choose based on the specific situation:\n` +
` - bump-version.yml (for major.minor format, such as ${parsedVersion.major}.${parsedVersion.minor})\n` +
` - bump-patch-version.yml (for patch version, such as ${parsedVersion.major}.${parsedVersion.minor}.${parsedVersion.patch})\n` +
`Considerations include: Is this the first pre-release version? Is it close to the official release?`
);
}
// Original logic for official versions
if (parsedVersion.patch === 0) {
return ['bump-version.yml', `${parsedVersion.major}.${parsedVersion.minor}`];
}
// Otherwise it's a patch version, use full version
return ['bump-patch-version.yml', version];
}
}

View File

@@ -13,7 +13,8 @@
"conventional-commits-parser": "^5.0.0",
"dayjs": "^1.11.11",
"dotenv": "^16.4.5",
"lodash": "^4.17.21"
"lodash": "^4.17.21",
"semver": "^7.7.3"
},
"devDependencies": {
"@types/conventional-commits-parser": "^5.0.0",

872
cyborg/pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff