fix: enable version bumping in manual release workflow
- Fix version-bump.js to actually update package.json version - Add tag existence check to prevent duplicate tag errors - Remove semantic-release dependency from version bumping
This commit is contained in:
parent
ba4fb4d084
commit
1772a30368
|
|
@ -129,8 +129,13 @@ jobs:
|
||||||
|
|
||||||
- name: Create and push tag
|
- name: Create and push tag
|
||||||
run: |
|
run: |
|
||||||
git tag -a "v${{ steps.version.outputs.new_version }}" -m "Release v${{ steps.version.outputs.new_version }}"
|
# Check if tag already exists
|
||||||
git push origin "v${{ steps.version.outputs.new_version }}"
|
if git rev-parse "v${{ steps.version.outputs.new_version }}" >/dev/null 2>&1; then
|
||||||
|
echo "Tag v${{ steps.version.outputs.new_version }} already exists, skipping tag creation"
|
||||||
|
else
|
||||||
|
git tag -a "v${{ steps.version.outputs.new_version }}" -m "Release v${{ steps.version.outputs.new_version }}"
|
||||||
|
git push origin "v${{ steps.version.outputs.new_version }}"
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Push changes to main
|
- name: Push changes to main
|
||||||
run: git push origin HEAD:main
|
run: git push origin HEAD:main
|
||||||
|
|
|
||||||
|
|
@ -31,18 +31,35 @@ async function bumpVersion(type = 'patch') {
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(chalk.yellow('⚠️ Manual version bumping is disabled.'));
|
const currentVersion = getCurrentVersion();
|
||||||
console.log(chalk.blue('🤖 This project uses semantic-release for automated versioning.'));
|
const versionParts = currentVersion.split('.').map(Number);
|
||||||
console.log('');
|
let newVersion;
|
||||||
console.log(chalk.bold('To create a new release, use conventional commits:'));
|
|
||||||
console.log(chalk.cyan(' feat: new feature (minor version bump)'));
|
|
||||||
console.log(chalk.cyan(' fix: bug fix (patch version bump)'));
|
|
||||||
console.log(chalk.cyan(' feat!: breaking change (major version bump)'));
|
|
||||||
console.log('');
|
|
||||||
console.log(chalk.dim('Example: git commit -m "feat: add new installer features"'));
|
|
||||||
console.log(chalk.dim('Then push to main branch to trigger automatic release.'));
|
|
||||||
|
|
||||||
return null;
|
switch (type) {
|
||||||
|
case 'major': {
|
||||||
|
newVersion = `${versionParts[0] + 1}.0.0`;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 'minor': {
|
||||||
|
newVersion = `${versionParts[0]}.${versionParts[1] + 1}.0`;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 'patch': {
|
||||||
|
newVersion = `${versionParts[0]}.${versionParts[1]}.${versionParts[2] + 1}`;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(chalk.blue(`Bumping version: ${currentVersion} → ${newVersion}`));
|
||||||
|
|
||||||
|
// Update package.json
|
||||||
|
const packageJson = JSON.parse(fs.readFileSync('package.json', 'utf8'));
|
||||||
|
packageJson.version = newVersion;
|
||||||
|
fs.writeFileSync('package.json', JSON.stringify(packageJson, null, 2) + '\n');
|
||||||
|
|
||||||
|
console.log(chalk.green(`✓ Updated package.json to ${newVersion}`));
|
||||||
|
|
||||||
|
return newVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue