@@ -23,6 +23,7 @@ program
2323 . command ( 'beta' )
2424 . description ( 'Starts a new beta' )
2525 . option ( '--merge-branch <mergeBranch>' , 'branch to merge' , 'main' )
26+ . option ( '--submitter <name>' , 'github username of the releaser' , '' )
2627 . option (
2728 '--next-ga [nextGa]' ,
2829 'next ga version, default to the next GA version in Jira'
@@ -32,6 +33,10 @@ program
3233 if ( ! options . mergeBranch ) {
3334 throw new Error ( 'mergeBranch is required' ) ;
3435 }
36+ if ( ! options . submitter ) {
37+ throw new Error ( 'submitter is required' ) ;
38+ }
39+ const publisher = getReleasePublisher ( options . submitter ) ;
3540
3641 const nextGa = options . nextGa || ( await getNextGaVersionInJira ( ) ) ;
3742
@@ -62,13 +67,14 @@ program
6267 console . info ( `Promoting ${ currentCompassPackageVersion } to ${ nextBeta } ` ) ;
6368
6469 await syncWithBranch ( options . mergeBranch ) ;
65- await bumpAndPush ( nextBeta , BETA_RELEASE_BRANCH ) ;
70+ await bumpAndPush ( nextBeta , BETA_RELEASE_BRANCH , publisher ) ;
6671 } ) ;
6772
6873program
6974 . command ( 'ga' )
7075 . description ( 'Starts a new GA' )
7176 . option ( '--release-ticket <releaseTicket>' )
77+ . option ( '--submitter <name>' , 'github username of the releaser' , '' )
7278 . option (
7379 '--merge-branch <mergeBranch>' ,
7480 'branch to merge' ,
@@ -83,6 +89,10 @@ program
8389 if ( ! options . mergeBranch ) {
8490 throw new Error ( 'mergeBranch is required' ) ;
8591 }
92+ if ( ! options . submitter ) {
93+ throw new Error ( 'submitter is required' ) ;
94+ }
95+ const publisher = getReleasePublisher ( options . submitter ) ;
8696
8797 const nextGa = await getReleaseVersionFromTicket ( options . releaseTicket ) ;
8898
@@ -104,7 +114,7 @@ program
104114 }
105115
106116 console . info ( `Promoting ${ currentCompassPackageVersion } to ${ nextGa } ` ) ;
107- await bumpAndPush ( nextGa , GA_RELEASE_BRANCH ) ;
117+ await bumpAndPush ( nextGa , GA_RELEASE_BRANCH , publisher ) ;
108118 } ) ;
109119
110120program . parseAsync ( ) ;
@@ -159,8 +169,37 @@ async function gitCheckout(branchName) {
159169 } ) ;
160170}
161171
162- async function bumpAndPush ( nextVersion , releaseBranch ) {
163- await execFile ( 'npm' , [ 'version' , nextVersion ] , { cwd : compassPackagePath } ) ;
172+ async function getReleasePublisher ( submitter ) {
173+ const publisherData = (
174+ await execFile (
175+ 'git' ,
176+ [ 'check-mailmap' , `<${ submitter } @users.noreply.github.com>` ] ,
177+ {
178+ cwd : monorepoRoot ,
179+ encoding : 'utf8' ,
180+ }
181+ )
182+ ) . stdout . trim ( ) ;
183+
184+ if ( ! publisherData . match ( / ^ [ ^ < ] + < [ ^ @ > ] + @ m o n g o d b .c o m > / ) ) {
185+ throw new Error (
186+ `Could not translate username ${ submitter } to recognized authorized email (${ publisherData } )`
187+ ) ;
188+ }
189+ return publisherData ;
190+ }
191+
192+ async function bumpAndPush ( nextVersion , releaseBranch , publisher ) {
193+ await execFile ( 'npm' , [ 'version' , '--no-git-tag-version' , nextVersion ] , {
194+ cwd : compassPackagePath ,
195+ } ) ;
196+ await fs . writeFile (
197+ compassPackageJsonPath ,
198+ JSON . stringify ( {
199+ ...JSON . parse ( await fs . readFile ( compassPackageJsonPath , 'utf8' ) ) ,
200+ releasePublisher : publisher ,
201+ } )
202+ ) ;
164203 await execFile ( 'git' , [ 'add' , compassPackageJsonPath , `package-lock.json` ] , {
165204 cwd : monorepoRoot ,
166205 } ) ;
@@ -174,6 +213,26 @@ async function bumpAndPush(nextVersion, releaseBranch) {
174213 cwd : monorepoRoot ,
175214 } ) ;
176215 await execFile ( 'git' , [ 'push' , '--tags' ] , { cwd : monorepoRoot } ) ;
216+
217+ const currentBranch = (
218+ await execFile ( 'git' , [ 'branch' , '--show-current' ] , {
219+ cwd : monorepoRoot ,
220+ encoding : 'utf8' ,
221+ } )
222+ ) . stdout . trim ( ) ;
223+ await execFile (
224+ 'gh' ,
225+ [
226+ 'workflow' ,
227+ 'run' ,
228+ 'codeql.yml' ,
229+ '-R' ,
230+ 'mongodb-js/compass' ,
231+ '-r' ,
232+ currentBranch ,
233+ ] ,
234+ { cwd : monorepoRoot }
235+ ) ;
177236}
178237
179238// NOTE: if there are more "unreleased" versions it will
0 commit comments