@@ -35,19 +35,13 @@ async function push (origin, branch, execaOpts) {
35
35
await execa ( 'git' , [ 'push' , '--follow-tags' , origin , `HEAD:${ branch } ` ] , execaOpts )
36
36
}
37
37
38
- /**
39
- * Merges the master branch into the dev branch. The devBranch must be specified
40
- * in the options for this to work.
41
- */
42
- async function mergeMasterIntoDev ( context ) {
38
+ async function configureGit ( context ) {
43
39
const { env, cwd, logger, options} = context
44
40
const execaOpts = { env, cwd}
45
- const { branch, devBranch, repositoryUrl} = options
46
-
47
- logger . log ( 'Merging master branch into dev branch' )
48
41
49
42
// fetch all branches because Travis doesn't do it for us
50
43
// code copied from https://stackoverflow.com/a/44036486/269834
44
+ logger . log ( 'configuring git' )
51
45
await execa (
52
46
'git' ,
53
47
[
@@ -60,24 +54,41 @@ async function mergeMasterIntoDev (context) {
60
54
)
61
55
62
56
// fetch everything
57
+ logger . log ( 'fetching branches' )
63
58
await execa ( 'git' , [ 'fetch' ] , execaOpts )
64
59
65
- // checkout master branch
66
- // this is done because otherwise the commit seems to be the one just before
67
- // the snapshot release
68
- await execa ( 'git' , [ 'checkout' , branch ] , execaOpts )
60
+ // checkout master and pull latest
61
+ logger . log ( 'checking out release branch' )
62
+ await execa ( 'git' , [ 'checkout' , options . branch ] , execaOpts )
69
63
70
- // pull changes into master
64
+ logger . log ( 'pulling' )
71
65
await execa ( 'git' , [ 'pull' ] , execaOpts )
66
+ }
67
+
68
+ /**
69
+ * Merges the master branch into the dev branch. The devBranch must be specified
70
+ * in the options for this to work.
71
+ */
72
+ async function mergeMasterIntoDev ( context ) {
73
+ const { env, cwd, logger, options} = context
74
+ const execaOpts = { env, cwd}
75
+ const { branch, devBranch, repositoryUrl} = options
76
+
77
+ logger . log ( 'Merging master branch into dev branch' )
72
78
73
79
// checkout dev branch
80
+ logger . log ( 'checking out dev branch' )
74
81
await execa ( 'git' , [ 'checkout' , devBranch ] , execaOpts )
75
82
76
83
// merge
84
+ logger . log ( 'merging release branch into dev branch' )
77
85
await execa ( 'git' , [ 'merge' , branch ] , execaOpts )
78
86
79
87
// push
88
+ logger . log ( 'pushing dev branch' )
80
89
await push ( repositoryUrl , devBranch , execaOpts )
90
+
91
+ logger . log ( 'merge and push successful!' )
81
92
}
82
93
83
94
/**
@@ -107,9 +118,12 @@ async function saveChangesToPomXml (context, versionStr) {
107
118
108
119
logger . log ( 'pushing changes' )
109
120
await push ( repositoryUrl , branch , execaOpts )
121
+
122
+ logger . log ( 'changes pushed' )
110
123
}
111
124
112
125
module . exports = {
126
+ configureGit,
113
127
mergeMasterIntoDev,
114
128
saveChangesToPomXml
115
129
}
0 commit comments