Skip to content

Commit

Permalink
fix(release): push to correct branch in toReleaseBranch strategy (#803)
Browse files Browse the repository at this point in the history
  • Loading branch information
Eunjae Lee authored May 8, 2020
1 parent 8055a9f commit 1367315
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
13 changes: 9 additions & 4 deletions packages/shipjs/src/step/release/__tests__/gitPush.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,13 @@ describe('gitPush', () => {
});

it('works in toReleaseBranch strategy', () => {
getCurrentBranch.mockImplementationOnce(() => 'develop');
getBranchNameToMergeBack.mockImplementationOnce(() => 'master');
/*
toReleaseBranch: {
develop: 'master'
}
*/
getCurrentBranch.mockImplementationOnce(() => 'master');
getBranchNameToMergeBack.mockImplementationOnce(() => 'develop');
gitPush({
tagName: 'v1.2.3',
config: {
Expand All @@ -41,14 +46,14 @@ describe('gitPush', () => {
expect(run).toHaveBeenCalledTimes(2);
expect(run.mock.calls[0][0]).toMatchInlineSnapshot(`
Object {
"command": "git checkout master",
"command": "git checkout develop",
"dir": ".",
"dryRun": false,
}
`);
expect(run.mock.calls[1][0]).toMatchInlineSnapshot(`
Object {
"command": "git merge develop",
"command": "git merge master",
"dir": ".",
"dryRun": false,
}
Expand Down
2 changes: 1 addition & 1 deletion packages/shipjs/src/step/release/gitPush.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ export default ({ tagName, config, dir, dryRun }) =>
// flow: develop -> master -> (here) develop
run({ command: `git checkout ${destinationBranch}`, dir, dryRun });
run({ command: `git merge ${currentBranch}`, dir, dryRun });
gitPush({ remote, refs: [currentBranch, tagName], dir, dryRun });
gitPush({ remote, refs: [destinationBranch, tagName], dir, dryRun });
}
});

0 comments on commit 1367315

Please sign in to comment.