@@ -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