@@ -173,17 +173,6 @@ function runRelease({
173173
174174 const releaseNotesPath = dependencies . releaseNotesPath || path . join ( 'docs' , 'release-notes' , 'RELEASE_NOTES.md' ) ;
175175 const updateNotes = dependencies . updateReleaseNotes || ( ( options = { } ) => updateReleaseNotes ( { rootDir : cwd , ...options } ) ) ;
176- const gitAdd = dependencies . gitAdd || ( ( files ) => spawnSync ( 'git' , [ 'add' , ...files ] , { stdio : 'inherit' , cwd } ) ) ;
177- const gitCommitAmend = dependencies . gitCommitAmend || ( ( ) => spawnSync ( 'git' , [ 'commit' , '--amend' , '--no-edit' ] , { stdio : 'inherit' , cwd } ) ) ;
178- const gitTag = dependencies . gitTag || ( ( tagName , tagMessage ) => {
179- const args = tagMessage
180- ? [ 'tag' , '-f' , '-a' , tagName , '-m' , tagMessage ]
181- : [ 'tag' , '-f' , tagName ] ;
182- return spawnSync ( 'git' , args , { stdio : 'inherit' , cwd } ) ;
183- } ) ;
184- const getCommitMessage = dependencies . getCommitMessage || ( ( ) => spawnSync ( 'git' , [ 'log' , '-1' , '--pretty=%s' ] , { cwd, encoding : 'utf8' } ) ) ;
185- const buildTagName = dependencies . buildTagName || ( ( version ) => `v${ version } ` ) ;
186- const loadPackage = dependencies . loadPackageJson || ( ( dir ) => loadPackageJson ( dir ) ) ;
187176
188177 let notesUpdated = false ;
189178 try {
@@ -193,40 +182,9 @@ function runRelease({
193182 }
194183
195184 if ( notesUpdated ) {
196- const gitAddResult = gitAdd ( [ releaseNotesPath ] ) ;
185+ const gitAddResult = spawnSync ( 'git' , [ 'add' , releaseNotesPath ] , { stdio : 'inherit' , cwd } ) ;
197186 if ( ! gitAddResult || typeof gitAddResult . status !== 'number' || gitAddResult . status !== 0 ) {
198- console . warn ( '⚠️ Release notes updated but failed to stage changes. Please add them manually.' ) ;
199- return releaseResult ;
200- }
201-
202- const gitCommitResult = gitCommitAmend ( ) ;
203- if ( ! gitCommitResult || typeof gitCommitResult . status !== 'number' || gitCommitResult . status !== 0 ) {
204- console . warn ( '⚠️ Release notes updated but failed to amend release commit. Please amend manually.' ) ;
205- return releaseResult ;
206- }
207-
208- const packageJson = loadPackage ( cwd ) ;
209- const version = packageJson && packageJson . version ;
210- if ( ! version ) {
211- console . warn ( '⚠️ Cannot retag release: package.json version missing. Please update tag manually.' ) ;
212- return releaseResult ;
213- }
214-
215- const tagName = buildTagName ( version ) ;
216- let tagMessage ;
217- try {
218- const commitMessageResult = getCommitMessage ( ) ;
219- if ( commitMessageResult && typeof commitMessageResult . status === 'number' && commitMessageResult . status === 0 ) {
220- const output = typeof commitMessageResult . stdout === 'string' ? commitMessageResult . stdout : '' ;
221- tagMessage = output . trim ( ) ;
222- }
223- } catch ( error ) {
224- console . warn ( `⚠️ Unable to read release commit message: ${ error . message } ` ) ;
225- }
226-
227- const gitTagResult = gitTag ( tagName , tagMessage ) ;
228- if ( ! gitTagResult || typeof gitTagResult . status !== 'number' || gitTagResult . status !== 0 ) {
229- console . warn ( `⚠️ Failed to retag ${ tagName } . Please update the tag manually before pushing.` ) ;
187+ console . warn ( '⚠️ Release notes updated but failed to stage. Please add manually: git add ' + releaseNotesPath ) ;
230188 }
231189 }
232190
0 commit comments