feat: create annotated tags

This commit is contained in:
Pierre Vanduynslager
2019-06-07 16:03:30 -04:00
parent 9948a74347
commit 4d581fc140
5 changed files with 18 additions and 11 deletions
+9 -5
View File
@@ -1,8 +1,9 @@
const {matches, pick, memoize} = require('lodash');
const {matches, pick, memoize, template} = require('lodash');
const gitLogParser = require('git-log-parser');
const getStream = require('get-stream');
const execa = require('execa');
const debug = require('debug')('semantic-release:git');
const {TAG_MESSAGE_FORMAT} = require('./definitions/constants');
Object.assign(gitLogParser.fields, {hash: 'H', message: 'B', gitTags: 'd', committerDate: {key: 'ci', type: Date}});
@@ -222,14 +223,17 @@ async function verifyAuth(repositoryUrl, branch, execaOpts) {
/**
* Tag the commit head on the local repository.
*
* @param {String} tagName The name of the tag.
* @param {String} ref The Git reference to tag.
* @param {Object} release The release associated with the tag.
* @param {Object} [execaOpts] Options to pass to `execa`.
*
* @throws {Error} if the tag creation failed.
*/
async function tag(tagName, ref, execaOpts) {
await execa('git', ['tag', tagName, ref], execaOpts);
async function tag(release, execaOpts) {
await execa(
'git',
['tag', release.gitTag, release.gitHead, '-a', '-m', template(TAG_MESSAGE_FORMAT)(release)],
execaOpts
);
}
/**