Skip to content

Commit 53c05eb

Browse files
committed
chore: bump version to 0.3.0
1 parent 3de8dbf commit 53c05eb

File tree

1 file changed

+26
-8
lines changed

1 file changed

+26
-8
lines changed

scripts/release.js

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,37 @@ try {
2828
// Update package.json version
2929
const packageJsonPath = path.join(__dirname, '..', 'package.json');
3030
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
31-
packageJson.version = releaseId;
32-
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2) + '\n');
31+
32+
// Skip if version is already set
33+
if (packageJson.version === releaseId) {
34+
console.log(`Version ${releaseId} is already set in package.json`);
35+
} else {
36+
packageJson.version = releaseId;
37+
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2) + '\n');
38+
}
3339

3440
// Update manifest.json version
3541
const manifestPath = path.join(__dirname, '..', 'src', 'manifest.json');
3642
const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf8'));
37-
manifest.version = releaseId;
38-
fs.writeFileSync(manifestPath, JSON.stringify(manifest, null, 2) + '\n');
43+
44+
// Skip if version is already set
45+
if (manifest.version === releaseId) {
46+
console.log(`Version ${releaseId} is already set in manifest.json`);
47+
} else {
48+
manifest.version = releaseId;
49+
fs.writeFileSync(manifestPath, JSON.stringify(manifest, null, 2) + '\n');
50+
}
3951

40-
// Git operations
41-
console.log('Committing version updates...');
42-
execSync('git add .');
43-
execSync(`git commit -m "chore: bump version to ${releaseId}"`);
52+
// Check if there are any changes to commit
53+
const status = execSync('git status --porcelain').toString();
54+
if (!status) {
55+
console.log('No changes to commit');
56+
} else {
57+
// Git operations
58+
console.log('Committing version updates...');
59+
execSync('git add .');
60+
execSync(`git commit -m "chore: bump version to ${releaseId}"`);
61+
}
4462

4563
// Check if tag exists
4664
const tagExists = execSync(`git tag -l v${releaseId}`).toString().trim() !== '';

0 commit comments

Comments
 (0)