Skip to content

Commit

Permalink
fix(tags): write an annotated git tag (#989)
Browse files Browse the repository at this point in the history
Some other tools like `git describe` (used by lerna) will only return annotated tags. As well, the git documentation ([link](https://git-scm.com/book/en/v2/Git-Basics-Tagging)) primarily documents writing annotated tags.

This commit changes the behaviour of tags written by shipjs to write annotated tags
  • Loading branch information
Haroenv committed Jan 9, 2023
1 parent 7b4ed0c commit 5c19401
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Expand Up @@ -11,7 +11,7 @@ describe('createGitTag', () => {
});
expect(run).toHaveBeenCalledTimes(1);
expect(run).toHaveBeenCalledWith({
command: 'git tag v1.2.3',
command: 'git tag -a v1.2.3 -m v1.2.3',
dir: '.',
dryRun: false,
});
Expand All @@ -27,7 +27,8 @@ describe('createGitTag', () => {
});
expect(run).toHaveBeenCalledTimes(1);
expect(run).toHaveBeenCalledWith({
command: 'git tag instantsearch.js@1.2.3 && git tag swag@4',
command:
'git tag -a instantsearch.js@1.2.3 -m instantsearch.js@1.2.3 && git tag -a swag@4 -m swag@4',
dir: '.',
dryRun: false,
});
Expand Down
4 changes: 3 additions & 1 deletion packages/shipjs/src/step/release/createGitTag.js
Expand Up @@ -5,7 +5,9 @@ export default ({ version, config, dir, dryRun }) =>
runStep({ title: 'Creating a git tag.' }, () => {
const { getTagName } = config;
const tagNames = arrayify(getTagName({ version }));
const command = tagNames.map((tag) => `git tag ${tag}`).join(' && ');
const command = tagNames
.map((tag) => `git tag -a ${tag} -m ${tag}`)
.join(' && ');
run({ command, dir, dryRun });
return { tagNames };
});

0 comments on commit 5c19401

Please sign in to comment.