From 961a99e1b24230fe5b9a7c2b7730bb2e6831fc41 Mon Sep 17 00:00:00 2001 From: Haroen Viaene Date: Mon, 9 Jan 2023 14:06:28 +0100 Subject: [PATCH] fix(tags): write an annotated git tag 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 --- .../shipjs/src/step/release/__tests__/createGitTag.spec.js | 5 +++-- packages/shipjs/src/step/release/createGitTag.js | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/shipjs/src/step/release/__tests__/createGitTag.spec.js b/packages/shipjs/src/step/release/__tests__/createGitTag.spec.js index f7e81c0c..cb50cd27 100644 --- a/packages/shipjs/src/step/release/__tests__/createGitTag.spec.js +++ b/packages/shipjs/src/step/release/__tests__/createGitTag.spec.js @@ -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, }); @@ -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, }); diff --git a/packages/shipjs/src/step/release/createGitTag.js b/packages/shipjs/src/step/release/createGitTag.js index 9b7fe9a2..da276b87 100644 --- a/packages/shipjs/src/step/release/createGitTag.js +++ b/packages/shipjs/src/step/release/createGitTag.js @@ -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 }; });