Compare commits

...

2 Commits

Author SHA1 Message Date
github-actions[bot]
cac3202945 chore(release): v0.0.8-nightly.5 2025-08-20 08:32:02 +00:00
tanzhenxin
213a017539 feat: add automated release notes generation with previous tag detection 2025-08-20 16:17:49 +08:00
8 changed files with 245 additions and 18 deletions

View File

@@ -84,6 +84,11 @@ jobs:
echo "RELEASE_TAG=$(echo $VERSION_JSON | jq -r .releaseTag)" >> $GITHUB_OUTPUT
echo "RELEASE_VERSION=$(echo $VERSION_JSON | jq -r .releaseVersion)" >> $GITHUB_OUTPUT
echo "NPM_TAG=$(echo $VERSION_JSON | jq -r .npmTag)" >> $GITHUB_OUTPUT
# Get the previous tag for release notes generation
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:
IS_NIGHTLY: ${{ steps.vars.outputs.is_nightly }}
MANUAL_VERSION: ${{ inputs.version }}
@@ -158,11 +163,20 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_BRANCH: ${{ steps.release_branch.outputs.BRANCH_NAME }}
run: |
gh release create ${{ steps.version.outputs.RELEASE_TAG }} \
bundle/gemini.js \
--target "$RELEASE_BRANCH" \
--title "Release ${{ steps.version.outputs.RELEASE_TAG }}" \
--generate-notes
# Build the gh release create command with appropriate options
RELEASE_CMD="gh release create ${{ steps.version.outputs.RELEASE_TAG }} bundle/gemini.js --target \"$RELEASE_BRANCH\" --title \"Release ${{ steps.version.outputs.RELEASE_TAG }}\""
# Add previous tag for release notes if available
if [[ -n "${{ steps.version.outputs.PREVIOUS_TAG }}" ]]; then
echo "Generating release notes from previous tag: ${{ steps.version.outputs.PREVIOUS_TAG }}"
RELEASE_CMD="$RELEASE_CMD --generate-notes --notes-start-tag ${{ steps.version.outputs.PREVIOUS_TAG }}"
else
echo "No previous tag found, generating release notes from repository history"
RELEASE_CMD="$RELEASE_CMD --generate-notes"
fi
# Execute the release command
eval $RELEASE_CMD
- name: Create Issue on Failure
if: failure()

12
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "@qwen-code/qwen-code",
"version": "0.0.7",
"version": "0.0.8-nightly.5",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@qwen-code/qwen-code",
"version": "0.0.7",
"version": "0.0.8-nightly.5",
"workspaces": [
"packages/*"
],
@@ -11758,7 +11758,7 @@
},
"packages/cli": {
"name": "@qwen-code/qwen-code",
"version": "0.0.7",
"version": "0.0.8-nightly.5",
"dependencies": {
"@google/genai": "1.9.0",
"@iarna/toml": "^2.2.5",
@@ -11963,7 +11963,7 @@
},
"packages/core": {
"name": "@qwen-code/qwen-code-core",
"version": "0.0.7",
"version": "0.0.8-nightly.5",
"dependencies": {
"@google/genai": "1.9.0",
"@modelcontextprotocol/sdk": "^1.11.0",
@@ -12113,7 +12113,7 @@
},
"packages/test-utils": {
"name": "@qwen-code/qwen-code-test-utils",
"version": "0.0.7",
"version": "0.0.8-nightly.5",
"license": "Apache-2.0",
"devDependencies": {
"typescript": "^5.3.3"
@@ -12124,7 +12124,7 @@
},
"packages/vscode-ide-companion": {
"name": "qwen-code-vscode-ide-companion",
"version": "0.0.7",
"version": "0.0.8-nightly.5",
"license": "LICENSE",
"dependencies": {
"@modelcontextprotocol/sdk": "^1.15.1",

View File

@@ -1,6 +1,6 @@
{
"name": "@qwen-code/qwen-code",
"version": "0.0.7",
"version": "0.0.8-nightly.5",
"engines": {
"node": ">=20.0.0"
},
@@ -13,7 +13,7 @@
"url": "git+https://github.com/QwenLM/qwen-code.git"
},
"config": {
"sandboxImageUri": "ghcr.io/qwenlm/qwen-code:0.0.7"
"sandboxImageUri": "ghcr.io/qwenlm/qwen-code:0.0.8-nightly.5"
},
"scripts": {
"start": "node scripts/start.js",

View File

@@ -1,6 +1,6 @@
{
"name": "@qwen-code/qwen-code",
"version": "0.0.7",
"version": "0.0.8-nightly.5",
"description": "Qwen Code",
"repository": {
"type": "git",
@@ -25,7 +25,7 @@
"dist"
],
"config": {
"sandboxImageUri": "ghcr.io/qwenlm/qwen-code:0.0.7"
"sandboxImageUri": "ghcr.io/qwenlm/qwen-code:0.0.8-nightly.5"
},
"dependencies": {
"@google/genai": "1.9.0",

View File

@@ -1,6 +1,6 @@
{
"name": "@qwen-code/qwen-code-core",
"version": "0.0.7",
"version": "0.0.8-nightly.5",
"description": "Qwen Code Core",
"repository": {
"type": "git",

View File

@@ -1,6 +1,6 @@
{
"name": "@qwen-code/qwen-code-test-utils",
"version": "0.0.7",
"version": "0.0.8-nightly.5",
"private": true,
"main": "src/index.ts",
"license": "Apache-2.0",

View File

@@ -2,7 +2,7 @@
"name": "qwen-code-vscode-ide-companion",
"displayName": "Qwen Code Companion",
"description": "Enable Qwen Code with direct access to your VS Code workspace.",
"version": "0.0.7",
"version": "0.0.8-nightly.5",
"publisher": "qwenlm",
"icon": "assets/icon.png",
"repository": {

213
scripts/get-previous-tag.js Normal file
View File

@@ -0,0 +1,213 @@
/**
* @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);
}
}