@@ -226,20 +226,28 @@ export default class ReleasePromotion extends Session {
226226
227227 async verifyTagSignature ( ) {
228228 const { cli, version } = this ;
229- const [ needle , haystack ] = await Promise . all ( [ forceRunAsync (
229+ const verifyTagPattern = / g p g : [ ^ \n ] + \n g p g : \s + u s i n g R S A k e y ( [ ^ \n ] + ) \n g p g : \s + i s s u e r " ( [ ^ " ] + ) " \n g p g : \s + G o o d s i g n a t u r e f r o m " ( [ ^ < ] + ) < \2> " / ;
230+ const [ verifyTagOutput , haystack ] = await Promise . all ( [ forceRunAsync (
230231 'git' , [ '--no-pager' ,
231- 'log' , '-1' ,
232- `refs/tags/v${ version } ` ,
233- '--format=* **%an** <<%ae>>\n `%GF`'
234- ] , { captureStdout : true } ) , fs . readFile ( 'README.md' ) ] ) ;
235- if ( haystack . includes ( needle ) ) {
236- return ;
232+ 'verify-tag' ,
233+ `v${ version } `
234+ ] , { ignoreFailure : false , captureStderr : true } ) , fs . readFile ( 'README.md' ) ] ) ;
235+ const match = verifyTagPattern . exec ( verifyTagOutput ) ;
236+ if ( match == null ) {
237+ cli . warn ( 'git was not able to verify the tag:' ) ;
238+ cli . info ( verifyTagOutput ) ;
239+ } else {
240+ const [ , keyID , email , name ] = match ;
241+ const needle = `* **${ name } ** <<${ email } >>\n ${ '`' } ${ keyID } ${ '`' } ` ;
242+ if ( haystack . includes ( needle ) ) {
243+ return ;
244+ }
245+ cli . warn ( 'Tag was signed with an undocumented identity/key pair!' ) ;
246+ cli . info ( 'Expected to find the following entry in the README:' ) ;
247+ cli . info ( needle ) ;
248+ cli . info ( 'If you are using a subkey, it might be OK.' ) ;
237249 }
238- cli . warn ( 'Tag was signed with an undocumented identity/key pair!' ) ;
239- cli . info ( 'Expected to find the following entry in the README:' ) ;
240- cli . info ( needle ) ;
241- cli . info ( 'If you are using a subkey, it might be OK.' ) ;
242- cli . info ( `Otherwise consider removing the tag (git tag -d v${ version
250+ cli . info ( `If that doesn't sound right, consider removing the tag (git tag -d v${ version
243251 } ), check your local config, and start the process over.`) ;
244252 if ( ! await cli . prompt ( 'Do you want to proceed anyway?' , { defaultAnswer : false } ) ) {
245253 throw new Error ( 'Aborted' ) ;
@@ -383,7 +391,6 @@ export default class ReleasePromotion extends Session {
383391 { cause : err }
384392 ) ;
385393 }
386- await forceRunAsync ( 'git' , [ 'tag' , '--verify' , `v${ version } ` ] , { ignoreFailure : false } ) ;
387394 this . cli . info ( 'Using the existing tag' ) ;
388395 }
389396 }
0 commit comments