Skip to content

Commit

Permalink
v2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
dfreeman committed Jul 13, 2020
1 parent bf58924 commit 7bf4fa4
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1780,8 +1780,12 @@ async function checkout(ref) {
await execa_1.default('git', ['checkout', ref]);
}
exports.checkout = checkout;
async function createTag(name) {
await execa_1.default('git', ['tag', name]);
async function createTag(name, annotation) {
let tagArgs = ['tag', name];
if (annotation.length) {
tagArgs.push('-m', annotation);
}
await execa_1.default('git', tagArgs);
await execa_1.default('git', ['push', '--tags']);
}
exports.createTag = createTag;
Expand Down Expand Up @@ -1973,6 +1977,7 @@ const core_1 = __webpack_require__(470);
const determine_version_1 = __webpack_require__(527);
const git_1 = __webpack_require__(136);
const utils_1 = __webpack_require__(611);
const VERSION_PLACEHOLDER = /{VERSION}/g;
async function run() {
await git_1.validateHistoryDepth();
await git_1.checkout('HEAD~1');
Expand All @@ -1985,14 +1990,16 @@ async function run() {
core_1.setOutput('current-version', currentVersion);
if (currentVersion !== previousVersion && core_1.getInput('create-tag') !== 'false') {
let tagTemplate = core_1.getInput('tag-template') || 'v{VERSION}';
let tag = tagTemplate.replace(/{VERSION}/g, currentVersion);
let tag = tagTemplate.replace(VERSION_PLACEHOLDER, currentVersion);
let annotationTemplate = core_1.getInput('tag-annotation-template') || 'Released version {VERSION}';
let annotation = annotationTemplate.replace(VERSION_PLACEHOLDER, currentVersion);
if (await git_1.refExists(tag)) {
core_1.info(`Tag ${tag} already exists`);
}
else {
core_1.info(`Creating tag ${tag}`);
core_1.setOutput('tag', tag);
await git_1.createTag(tag);
await git_1.createTag(tag, annotation);
}
}
}
Expand Down

0 comments on commit 7bf4fa4

Please sign in to comment.