mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-19 09:33:53 +00:00
chore: pump version to 0.1.0, and optimize release workflow
This commit is contained in:
26
.github/workflows/release.yml
vendored
26
.github/workflows/release.yml
vendored
@@ -101,15 +101,27 @@ jobs:
|
|||||||
- name: 'Get the version'
|
- name: 'Get the version'
|
||||||
id: 'version'
|
id: 'version'
|
||||||
run: |
|
run: |
|
||||||
VERSION_JSON=$(node scripts/get-release-version.js)
|
VERSION_ARGS=()
|
||||||
|
if [[ "${IS_NIGHTLY}" == "true" ]]; then
|
||||||
|
VERSION_ARGS+=(--type=nightly)
|
||||||
|
elif [[ "${IS_PREVIEW}" == "true" ]]; then
|
||||||
|
VERSION_ARGS+=(--type=preview)
|
||||||
|
if [[ -n "${MANUAL_VERSION}" ]]; then
|
||||||
|
VERSION_ARGS+=("--preview_version_override=${MANUAL_VERSION}")
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
VERSION_ARGS+=(--type=stable)
|
||||||
|
if [[ -n "${MANUAL_VERSION}" ]]; then
|
||||||
|
VERSION_ARGS+=("--stable_version_override=${MANUAL_VERSION}")
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
VERSION_JSON=$(node scripts/get-release-version.js "${VERSION_ARGS[@]}")
|
||||||
echo "RELEASE_TAG=$(echo "$VERSION_JSON" | jq -r .releaseTag)" >> "$GITHUB_OUTPUT"
|
echo "RELEASE_TAG=$(echo "$VERSION_JSON" | jq -r .releaseTag)" >> "$GITHUB_OUTPUT"
|
||||||
echo "RELEASE_VERSION=$(echo "$VERSION_JSON" | jq -r .releaseVersion)" >> "$GITHUB_OUTPUT"
|
echo "RELEASE_VERSION=$(echo "$VERSION_JSON" | jq -r .releaseVersion)" >> "$GITHUB_OUTPUT"
|
||||||
echo "NPM_TAG=$(echo "$VERSION_JSON" | jq -r .npmTag)" >> "$GITHUB_OUTPUT"
|
echo "NPM_TAG=$(echo "$VERSION_JSON" | jq -r .npmTag)" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
# Get the previous tag for release notes generation
|
echo "PREVIOUS_RELEASE_TAG=$(echo "$VERSION_JSON" | jq -r .previousReleaseTag)" >> "$GITHUB_OUTPUT"
|
||||||
CURRENT_TAG=$(echo "$VERSION_JSON" | jq -r .releaseTag)
|
|
||||||
PREVIOUS_TAG=$(node scripts/get-previous-tag.js "$CURRENT_TAG" || echo "")
|
|
||||||
echo "PREVIOUS_TAG=${PREVIOUS_TAG}" >> "$GITHUB_OUTPUT"
|
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
|
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
|
||||||
IS_NIGHTLY: '${{ steps.vars.outputs.is_nightly }}'
|
IS_NIGHTLY: '${{ steps.vars.outputs.is_nightly }}'
|
||||||
@@ -189,13 +201,13 @@ jobs:
|
|||||||
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
|
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
|
||||||
RELEASE_BRANCH: '${{ steps.release_branch.outputs.BRANCH_NAME }}'
|
RELEASE_BRANCH: '${{ steps.release_branch.outputs.BRANCH_NAME }}'
|
||||||
RELEASE_TAG: '${{ steps.version.outputs.RELEASE_TAG }}'
|
RELEASE_TAG: '${{ steps.version.outputs.RELEASE_TAG }}'
|
||||||
PREVIOUS_TAG: '${{ steps.version.outputs.PREVIOUS_TAG }}'
|
PREVIOUS_RELEASE_TAG: '${{ steps.version.outputs.PREVIOUS_RELEASE_TAG }}'
|
||||||
run: |-
|
run: |-
|
||||||
gh release create "${RELEASE_TAG}" \
|
gh release create "${RELEASE_TAG}" \
|
||||||
dist/cli.js \
|
dist/cli.js \
|
||||||
--target "$RELEASE_BRANCH" \
|
--target "$RELEASE_BRANCH" \
|
||||||
--title "Release ${RELEASE_TAG}" \
|
--title "Release ${RELEASE_TAG}" \
|
||||||
--notes-start-tag "$PREVIOUS_TAG" \
|
--notes-start-tag "$PREVIOUS_RELEASE_TAG" \
|
||||||
--generate-notes
|
--generate-notes
|
||||||
|
|
||||||
- name: 'Create Issue on Failure'
|
- name: 'Create Issue on Failure'
|
||||||
|
|||||||
12
package-lock.json
generated
12
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "@qwen-code/qwen-code",
|
"name": "@qwen-code/qwen-code",
|
||||||
"version": "0.0.14",
|
"version": "0.1.0",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@qwen-code/qwen-code",
|
"name": "@qwen-code/qwen-code",
|
||||||
"version": "0.0.14",
|
"version": "0.1.0",
|
||||||
"workspaces": [
|
"workspaces": [
|
||||||
"packages/*"
|
"packages/*"
|
||||||
],
|
],
|
||||||
@@ -16024,7 +16024,7 @@
|
|||||||
},
|
},
|
||||||
"packages/cli": {
|
"packages/cli": {
|
||||||
"name": "@qwen-code/qwen-code",
|
"name": "@qwen-code/qwen-code",
|
||||||
"version": "0.0.14",
|
"version": "0.1.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@google/genai": "1.16.0",
|
"@google/genai": "1.16.0",
|
||||||
"@iarna/toml": "^2.2.5",
|
"@iarna/toml": "^2.2.5",
|
||||||
@@ -16139,7 +16139,7 @@
|
|||||||
},
|
},
|
||||||
"packages/core": {
|
"packages/core": {
|
||||||
"name": "@qwen-code/qwen-code-core",
|
"name": "@qwen-code/qwen-code-core",
|
||||||
"version": "0.0.14",
|
"version": "0.1.0",
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@google/genai": "1.16.0",
|
"@google/genai": "1.16.0",
|
||||||
@@ -16278,7 +16278,7 @@
|
|||||||
},
|
},
|
||||||
"packages/test-utils": {
|
"packages/test-utils": {
|
||||||
"name": "@qwen-code/qwen-code-test-utils",
|
"name": "@qwen-code/qwen-code-test-utils",
|
||||||
"version": "0.0.14",
|
"version": "0.1.0",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
@@ -16290,7 +16290,7 @@
|
|||||||
},
|
},
|
||||||
"packages/vscode-ide-companion": {
|
"packages/vscode-ide-companion": {
|
||||||
"name": "qwen-code-vscode-ide-companion",
|
"name": "qwen-code-vscode-ide-companion",
|
||||||
"version": "0.0.14",
|
"version": "0.1.0",
|
||||||
"license": "LICENSE",
|
"license": "LICENSE",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@modelcontextprotocol/sdk": "^1.15.1",
|
"@modelcontextprotocol/sdk": "^1.15.1",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@qwen-code/qwen-code",
|
"name": "@qwen-code/qwen-code",
|
||||||
"version": "0.0.14",
|
"version": "0.1.0",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=20.0.0"
|
"node": ">=20.0.0"
|
||||||
},
|
},
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
"url": "git+https://github.com/QwenLM/qwen-code.git"
|
"url": "git+https://github.com/QwenLM/qwen-code.git"
|
||||||
},
|
},
|
||||||
"config": {
|
"config": {
|
||||||
"sandboxImageUri": "ghcr.io/qwenlm/qwen-code:0.0.14"
|
"sandboxImageUri": "ghcr.io/qwenlm/qwen-code:0.1.0"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "cross-env node scripts/start.js",
|
"start": "cross-env node scripts/start.js",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@qwen-code/qwen-code",
|
"name": "@qwen-code/qwen-code",
|
||||||
"version": "0.0.14",
|
"version": "0.1.0",
|
||||||
"description": "Qwen Code",
|
"description": "Qwen Code",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
"dist"
|
"dist"
|
||||||
],
|
],
|
||||||
"config": {
|
"config": {
|
||||||
"sandboxImageUri": "ghcr.io/qwenlm/qwen-code:0.0.14"
|
"sandboxImageUri": "ghcr.io/qwenlm/qwen-code:0.1.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@google/genai": "1.16.0",
|
"@google/genai": "1.16.0",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@qwen-code/qwen-code-core",
|
"name": "@qwen-code/qwen-code-core",
|
||||||
"version": "0.0.14",
|
"version": "0.1.0",
|
||||||
"description": "Qwen Code Core",
|
"description": "Qwen Code Core",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@qwen-code/qwen-code-test-utils",
|
"name": "@qwen-code/qwen-code-test-utils",
|
||||||
"version": "0.0.14",
|
"version": "0.1.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"main": "src/index.ts",
|
"main": "src/index.ts",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
"name": "qwen-code-vscode-ide-companion",
|
"name": "qwen-code-vscode-ide-companion",
|
||||||
"displayName": "Qwen Code Companion",
|
"displayName": "Qwen Code Companion",
|
||||||
"description": "Enable Qwen Code with direct access to your VS Code workspace.",
|
"description": "Enable Qwen Code with direct access to your VS Code workspace.",
|
||||||
"version": "0.0.14",
|
"version": "0.1.0",
|
||||||
"publisher": "qwenlm",
|
"publisher": "qwenlm",
|
||||||
"icon": "assets/icon.png",
|
"icon": "assets/icon.png",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|||||||
@@ -1,213 +0,0 @@
|
|||||||
/**
|
|
||||||
* @license
|
|
||||||
* Copyright 2025 Google LLC
|
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { execSync } from 'child_process';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determines the correct previous tag for release notes generation.
|
|
||||||
* This function handles the complexity of mixed tag types (regular releases vs nightly releases).
|
|
||||||
*
|
|
||||||
* @param {string} currentTag - The current release tag (e.g., "v0.1.23")
|
|
||||||
* @returns {string|null} - The previous tag to compare against, or null if no suitable tag found
|
|
||||||
*/
|
|
||||||
export function getPreviousTag(currentTag) {
|
|
||||||
try {
|
|
||||||
// Parse the current tag to understand its type
|
|
||||||
const currentTagInfo = parseTag(currentTag);
|
|
||||||
if (!currentTagInfo) {
|
|
||||||
console.error(`Invalid current tag format: ${currentTag}`);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Find the appropriate previous tag based on the current tag type
|
|
||||||
let previousTag = null;
|
|
||||||
|
|
||||||
if (currentTagInfo.isNightly) {
|
|
||||||
// For nightly releases, find the last stable release
|
|
||||||
previousTag = findLastStableTag(currentTagInfo);
|
|
||||||
} else {
|
|
||||||
// For stable releases, find the previous stable release
|
|
||||||
previousTag = findPreviousStableTag(currentTagInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
return previousTag;
|
|
||||||
} catch (error) {
|
|
||||||
console.error('Error getting previous tag:', error.message);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Parses a tag string to extract version information and type
|
|
||||||
*/
|
|
||||||
function parseTag(tag) {
|
|
||||||
// Remove 'v' prefix if present
|
|
||||||
const cleanTag = tag.startsWith('v') ? tag.substring(1) : tag;
|
|
||||||
|
|
||||||
// Match pattern: X.Y.Z or X.Y.Z-prerelease
|
|
||||||
const match = cleanTag.match(/^(\d+)\.(\d+)\.(\d+)(?:-(.+))?$/);
|
|
||||||
if (!match) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
const [, major, minor, patch, prerelease] = match;
|
|
||||||
|
|
||||||
return {
|
|
||||||
original: tag,
|
|
||||||
major: parseInt(major),
|
|
||||||
minor: parseInt(minor),
|
|
||||||
patch: parseInt(patch),
|
|
||||||
prerelease: prerelease || null,
|
|
||||||
isNightly: prerelease && prerelease.startsWith('nightly'),
|
|
||||||
isPreview: prerelease && prerelease.startsWith('preview'),
|
|
||||||
version: `${major}.${minor}.${patch}`,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Finds the last stable tag for a nightly release
|
|
||||||
* Assumes version numbers are incremental and checks backwards from current version
|
|
||||||
*/
|
|
||||||
function findLastStableTag(currentTagInfo) {
|
|
||||||
// For nightly releases, find the stable version of the same version number first
|
|
||||||
const baseVersion = `v${currentTagInfo.version}`;
|
|
||||||
|
|
||||||
// Check if the stable version of the current version exists
|
|
||||||
if (tagExists(baseVersion)) {
|
|
||||||
return baseVersion;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If not, look for the previous stable versions by decrementing version numbers
|
|
||||||
let { major, minor, patch } = currentTagInfo;
|
|
||||||
|
|
||||||
// Try decrementing patch version first
|
|
||||||
while (patch > 0) {
|
|
||||||
patch--;
|
|
||||||
const candidateTag = `v${major}.${minor}.${patch}`;
|
|
||||||
if (tagExists(candidateTag)) {
|
|
||||||
return candidateTag;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Try decrementing minor version
|
|
||||||
while (minor > 0) {
|
|
||||||
minor--;
|
|
||||||
patch = 999; // Start from a high patch number and work backwards
|
|
||||||
while (patch >= 0) {
|
|
||||||
const candidateTag = `v${major}.${minor}.${patch}`;
|
|
||||||
if (tagExists(candidateTag)) {
|
|
||||||
return candidateTag;
|
|
||||||
}
|
|
||||||
patch--;
|
|
||||||
// Don't check too many patch versions to avoid infinite loops
|
|
||||||
if (patch < 0) break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Try decrementing major version
|
|
||||||
while (major > 0) {
|
|
||||||
major--;
|
|
||||||
minor = 999; // Start from a high minor number and work backwards
|
|
||||||
while (minor >= 0) {
|
|
||||||
patch = 999;
|
|
||||||
while (patch >= 0) {
|
|
||||||
const candidateTag = `v${major}.${minor}.${patch}`;
|
|
||||||
if (tagExists(candidateTag)) {
|
|
||||||
return candidateTag;
|
|
||||||
}
|
|
||||||
patch--;
|
|
||||||
if (patch < 0) break;
|
|
||||||
}
|
|
||||||
minor--;
|
|
||||||
if (minor < 0) break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Finds the previous stable tag for a stable release
|
|
||||||
* Assumes version numbers are incremental and checks backwards from current version
|
|
||||||
*/
|
|
||||||
function findPreviousStableTag(currentTagInfo) {
|
|
||||||
let { major, minor, patch } = currentTagInfo;
|
|
||||||
|
|
||||||
// Try decrementing patch version first
|
|
||||||
while (patch > 0) {
|
|
||||||
patch--;
|
|
||||||
const candidateTag = `v${major}.${minor}.${patch}`;
|
|
||||||
if (tagExists(candidateTag)) {
|
|
||||||
return candidateTag;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Try decrementing minor version
|
|
||||||
while (minor > 0) {
|
|
||||||
minor--;
|
|
||||||
patch = 999; // Start from a high patch number and work backwards
|
|
||||||
while (patch >= 0) {
|
|
||||||
const candidateTag = `v${major}.${minor}.${patch}`;
|
|
||||||
if (tagExists(candidateTag)) {
|
|
||||||
return candidateTag;
|
|
||||||
}
|
|
||||||
patch--;
|
|
||||||
// Don't check too many patch versions to avoid infinite loops
|
|
||||||
if (patch < 0) break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Try decrementing major version
|
|
||||||
while (major > 0) {
|
|
||||||
major--;
|
|
||||||
minor = 999; // Start from a high minor number and work backwards
|
|
||||||
while (minor >= 0) {
|
|
||||||
patch = 999;
|
|
||||||
while (patch >= 0) {
|
|
||||||
const candidateTag = `v${major}.${minor}.${patch}`;
|
|
||||||
if (tagExists(candidateTag)) {
|
|
||||||
return candidateTag;
|
|
||||||
}
|
|
||||||
patch--;
|
|
||||||
if (patch < 0) break;
|
|
||||||
}
|
|
||||||
minor--;
|
|
||||||
if (minor < 0) break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks if a git tag exists
|
|
||||||
*/
|
|
||||||
function tagExists(tag) {
|
|
||||||
try {
|
|
||||||
execSync(`git rev-parse --verify ${tag}`, { stdio: 'ignore' });
|
|
||||||
return true;
|
|
||||||
} catch {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// CLI usage
|
|
||||||
if (process.argv[1] === new URL(import.meta.url).pathname) {
|
|
||||||
const currentTag = process.argv[2];
|
|
||||||
|
|
||||||
if (!currentTag) {
|
|
||||||
console.error('Usage: node get-previous-tag.js <current-tag>');
|
|
||||||
process.exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
const previousTag = getPreviousTag(currentTag);
|
|
||||||
if (previousTag) {
|
|
||||||
console.log(previousTag);
|
|
||||||
} else {
|
|
||||||
console.error('No suitable previous tag found');
|
|
||||||
process.exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -26,36 +26,8 @@ function getArgs() {
|
|||||||
return args;
|
return args;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getLatestTag(pattern) {
|
|
||||||
const command = `git tag -l '${pattern}'`;
|
|
||||||
try {
|
|
||||||
const tags = execSync(command)
|
|
||||||
.toString()
|
|
||||||
.trim()
|
|
||||||
.split('\n')
|
|
||||||
.filter(Boolean);
|
|
||||||
if (tags.length === 0) return '';
|
|
||||||
|
|
||||||
// Convert tags to versions (remove 'v' prefix) and sort by semver
|
|
||||||
const versions = tags
|
|
||||||
.map((tag) => tag.replace(/^v/, ''))
|
|
||||||
.filter((version) => semver.valid(version))
|
|
||||||
.sort((a, b) => semver.rcompare(a, b)); // rcompare for descending order
|
|
||||||
|
|
||||||
if (versions.length === 0) return '';
|
|
||||||
|
|
||||||
// Return the latest version with 'v' prefix restored
|
|
||||||
return `v${versions[0]}`;
|
|
||||||
} catch (error) {
|
|
||||||
console.error(
|
|
||||||
`Failed to get latest git tag for pattern "${pattern}": ${error.message}`,
|
|
||||||
);
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function getVersionFromNPM(distTag) {
|
function getVersionFromNPM(distTag) {
|
||||||
const command = `npm view @google/gemini-cli version --tag=${distTag}`;
|
const command = `npm view @qwen-code/qwen-code version --tag=${distTag}`;
|
||||||
try {
|
try {
|
||||||
return execSync(command).toString().trim();
|
return execSync(command).toString().trim();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -67,7 +39,7 @@ function getVersionFromNPM(distTag) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getAllVersionsFromNPM() {
|
function getAllVersionsFromNPM() {
|
||||||
const command = `npm view @google/gemini-cli versions --json`;
|
const command = `npm view @qwen-code/qwen-code versions --json`;
|
||||||
try {
|
try {
|
||||||
const versionsJson = execSync(command).toString().trim();
|
const versionsJson = execSync(command).toString().trim();
|
||||||
return JSON.parse(versionsJson);
|
return JSON.parse(versionsJson);
|
||||||
@@ -78,7 +50,7 @@ function getAllVersionsFromNPM() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function isVersionDeprecated(version) {
|
function isVersionDeprecated(version) {
|
||||||
const command = `npm view @google/gemini-cli@${version} deprecated`;
|
const command = `npm view @qwen-code/qwen-code@${version} deprecated`;
|
||||||
try {
|
try {
|
||||||
const output = execSync(command).toString().trim();
|
const output = execSync(command).toString().trim();
|
||||||
return output.length > 0;
|
return output.length > 0;
|
||||||
@@ -159,7 +131,7 @@ function detectRollbackAndGetBaseline(npmDistTag) {
|
|||||||
function doesVersionExist(version) {
|
function doesVersionExist(version) {
|
||||||
// Check NPM
|
// Check NPM
|
||||||
try {
|
try {
|
||||||
const command = `npm view @google/gemini-cli@${version} version 2>/dev/null`;
|
const command = `npm view @qwen-code/qwen-code@${version} version 2>/dev/null`;
|
||||||
const output = execSync(command).toString().trim();
|
const output = execSync(command).toString().trim();
|
||||||
if (output === version) {
|
if (output === version) {
|
||||||
console.error(`Version ${version} already exists on NPM.`);
|
console.error(`Version ${version} already exists on NPM.`);
|
||||||
@@ -229,11 +201,20 @@ function getAndVerifyTags(npmDistTag, _gitTagPattern) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getLatestStableReleaseTag() {
|
||||||
|
try {
|
||||||
|
const { latestTag } = getAndVerifyTags('latest', 'v[0-9].[0-9].[0-9]');
|
||||||
|
return latestTag;
|
||||||
|
} catch (error) {
|
||||||
|
console.error(
|
||||||
|
`Failed to determine latest stable release tag: ${error.message}`,
|
||||||
|
);
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function promoteNightlyVersion() {
|
function promoteNightlyVersion() {
|
||||||
const { latestVersion, latestTag } = getAndVerifyTags(
|
const { latestVersion } = getAndVerifyTags('nightly', 'v*-nightly*');
|
||||||
'nightly',
|
|
||||||
'v*-nightly*',
|
|
||||||
);
|
|
||||||
const baseVersion = latestVersion.split('-')[0];
|
const baseVersion = latestVersion.split('-')[0];
|
||||||
const versionParts = baseVersion.split('.');
|
const versionParts = baseVersion.split('.');
|
||||||
const major = versionParts[0];
|
const major = versionParts[0];
|
||||||
@@ -244,7 +225,6 @@ function promoteNightlyVersion() {
|
|||||||
return {
|
return {
|
||||||
releaseVersion: `${major}.${nextMinor}.0-nightly.${date}.${gitShortHash}`,
|
releaseVersion: `${major}.${nextMinor}.0-nightly.${date}.${gitShortHash}`,
|
||||||
npmTag: 'nightly',
|
npmTag: 'nightly',
|
||||||
previousReleaseTag: latestTag,
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -254,12 +234,9 @@ function getNightlyVersion() {
|
|||||||
const date = new Date().toISOString().slice(0, 10).replace(/-/g, '');
|
const date = new Date().toISOString().slice(0, 10).replace(/-/g, '');
|
||||||
const gitShortHash = execSync('git rev-parse --short HEAD').toString().trim();
|
const gitShortHash = execSync('git rev-parse --short HEAD').toString().trim();
|
||||||
const releaseVersion = `${baseVersion}-nightly.${date}.${gitShortHash}`;
|
const releaseVersion = `${baseVersion}-nightly.${date}.${gitShortHash}`;
|
||||||
const previousReleaseTag = getLatestTag('v*-nightly*');
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
releaseVersion,
|
releaseVersion,
|
||||||
npmTag: 'nightly',
|
npmTag: 'nightly',
|
||||||
previousReleaseTag,
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -290,15 +267,9 @@ function getStableVersion(args) {
|
|||||||
releaseVersion = latestPreviewVersion.replace(/-preview.*/, '');
|
releaseVersion = latestPreviewVersion.replace(/-preview.*/, '');
|
||||||
}
|
}
|
||||||
|
|
||||||
const { latestTag: previousStableTag } = getAndVerifyTags(
|
|
||||||
'latest',
|
|
||||||
'v[0-9].[0-9].[0-9]',
|
|
||||||
);
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
releaseVersion,
|
releaseVersion,
|
||||||
npmTag: 'latest',
|
npmTag: 'latest',
|
||||||
previousReleaseTag: previousStableTag,
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -321,15 +292,9 @@ function getPreviewVersion(args) {
|
|||||||
latestNightlyVersion.replace(/-nightly.*/, '') + '-preview.0';
|
latestNightlyVersion.replace(/-nightly.*/, '') + '-preview.0';
|
||||||
}
|
}
|
||||||
|
|
||||||
const { latestTag: previousPreviewTag } = getAndVerifyTags(
|
|
||||||
'preview',
|
|
||||||
'v*-preview*',
|
|
||||||
);
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
releaseVersion,
|
releaseVersion,
|
||||||
npmTag: 'preview',
|
npmTag: 'preview',
|
||||||
previousReleaseTag: previousPreviewTag,
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -341,7 +306,7 @@ function getPatchVersion(patchFrom) {
|
|||||||
}
|
}
|
||||||
const distTag = patchFrom === 'stable' ? 'latest' : 'preview';
|
const distTag = patchFrom === 'stable' ? 'latest' : 'preview';
|
||||||
const pattern = distTag === 'latest' ? 'v[0-9].[0-9].[0-9]' : 'v*-preview*';
|
const pattern = distTag === 'latest' ? 'v[0-9].[0-9].[0-9]' : 'v*-preview*';
|
||||||
const { latestVersion, latestTag } = getAndVerifyTags(distTag, pattern);
|
const { latestVersion } = getAndVerifyTags(distTag, pattern);
|
||||||
|
|
||||||
if (patchFrom === 'stable') {
|
if (patchFrom === 'stable') {
|
||||||
// For stable versions, increment the patch number: 0.5.4 -> 0.5.5
|
// For stable versions, increment the patch number: 0.5.4 -> 0.5.5
|
||||||
@@ -353,7 +318,6 @@ function getPatchVersion(patchFrom) {
|
|||||||
return {
|
return {
|
||||||
releaseVersion,
|
releaseVersion,
|
||||||
npmTag: distTag,
|
npmTag: distTag,
|
||||||
previousReleaseTag: latestTag,
|
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
// For preview versions, increment the preview number: 0.6.0-preview.2 -> 0.6.0-preview.3
|
// For preview versions, increment the preview number: 0.6.0-preview.2 -> 0.6.0-preview.3
|
||||||
@@ -373,7 +337,6 @@ function getPatchVersion(patchFrom) {
|
|||||||
return {
|
return {
|
||||||
releaseVersion,
|
releaseVersion,
|
||||||
npmTag: distTag,
|
npmTag: distTag,
|
||||||
previousReleaseTag: latestTag,
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -438,6 +401,8 @@ export function getVersion(options = {}) {
|
|||||||
...versionData,
|
...versionData,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
result.previousReleaseTag = getLatestStableReleaseTag();
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user