@@ -30,23 +30,40 @@ exports.cleanTree = async () => {
30
30
} ) ;
31
31
} ;
32
32
33
- exports . commitAndTag = async ( updatedVersions , releaseType ) => {
34
- await git . add ( '*/package.json' ) ;
35
- await git . commit (
36
- releaseType === 'Staging' ? 'Publish Prerelease' : 'Publish'
33
+ /**
34
+ * Commits the current state of the repository and tags it with the appropriate
35
+ * version changes.
36
+ *
37
+ * Returns the tagged commits
38
+ */
39
+ exports . commitAndTag = async updatedVersions => {
40
+ await exec ( 'git add */package.json' ) ;
41
+
42
+ let result = await exec (
43
+ `git commit -m "Publish firebase@${ updatedVersions . firebase } "`
37
44
) ;
38
- Object . keys ( updatedVersions )
39
- . map ( name => ( { name, version : updatedVersions [ name ] } ) )
40
- . forEach ( async ( { name, version } ) => {
41
- await git . addTag ( `${ name } @${ version } ` ) ;
42
- } ) ;
45
+
46
+ const tags = [ ] ;
47
+ await Promise . all (
48
+ Object . keys ( updatedVersions )
49
+ . map ( name => ( { name, version : updatedVersions [ name ] } ) )
50
+ . map ( async ( { name, version } ) => {
51
+ const tag = `${ name } @${ version } ` ;
52
+ const result = await exec ( `git tag ${ tag } ` ) ;
53
+ tags . push ( tag ) ;
54
+ } )
55
+ ) ;
56
+ return tags ;
43
57
} ;
44
58
45
- exports . pushUpdatesToGithub = async ( ) => {
46
- await git . push ( 'origin' , 'master' , {
47
- '--follow-tags' : null ,
48
- '--no-verify' : null
49
- } ) ;
59
+ exports . pushUpdatesToGithub = async tags => {
60
+ let { stdout : currentBranch , stderr } = await exec (
61
+ `git rev-parse --abbrev-ref HEAD`
62
+ ) ;
63
+ currentBranch = currentBranch . trim ( ) ;
64
+
65
+ await exec ( `git push origin ${ currentBranch } --no-verify -u` , { cwd : root } ) ;
66
+ await exec ( `git push origin ${ tags . join ( ' ' ) } ` ) ;
50
67
} ;
51
68
52
69
exports . resetWorkingTree = async ( ) => {
0 commit comments