mirror of
https://github.com/PaulHatch/semantic-version.git
synced 2025-12-27 13:08:17 +00:00
Add version tag output (MINOR)
This commit is contained in:
parent
7f624e6710
commit
917165076c
3 changed files with 30 additions and 6 deletions
|
|
@ -13,11 +13,11 @@ inputs:
|
||||||
required: false
|
required: false
|
||||||
default: "v"
|
default: "v"
|
||||||
major_pattern:
|
major_pattern:
|
||||||
description: "a string which, if present in a git commit, indicates that a change represents a major (breaking) change"
|
description: "A string which, if present in a git commit, indicates that a change represents a major (breaking) change"
|
||||||
required: true
|
required: true
|
||||||
default: "(MAJOR)"
|
default: "(MAJOR)"
|
||||||
minor_pattern:
|
minor_pattern:
|
||||||
description: "a string which, if present in a git commit, indicates that a change represents a minor (feature) change"
|
description: "A string which, if present in a git commit, indicates that a change represents a minor (feature) change"
|
||||||
required: true
|
required: true
|
||||||
default: "(MINOR)"
|
default: "(MINOR)"
|
||||||
format:
|
format:
|
||||||
|
|
@ -41,6 +41,8 @@ outputs:
|
||||||
description: "An additional value indicating the number of commits for the current version"
|
description: "An additional value indicating the number of commits for the current version"
|
||||||
version:
|
version:
|
||||||
description: "The version result, in the format {major}.{minor}.{patch}"
|
description: "The version result, in the format {major}.{minor}.{patch}"
|
||||||
|
version_tag:
|
||||||
|
description: "The version result with trailing zeros removed"
|
||||||
changed:
|
changed:
|
||||||
description: "Indicates whether there was a change since the last version if change_path was specified. If no change_path was specified this value will always be true since the entire repo is considered."
|
description: "Indicates whether there was a change since the last version if change_path was specified. If no change_path was specified this value will always be true since the entire repo is considered."
|
||||||
runs:
|
runs:
|
||||||
|
|
|
||||||
15
dist/index.js
vendored
15
dist/index.js
vendored
|
|
@ -982,20 +982,31 @@ const setOutput = (major, minor, patch, increment, changed, branch, namespace) =
|
||||||
version += `-${namespace}`
|
version += `-${namespace}`
|
||||||
}
|
}
|
||||||
|
|
||||||
const tag = tagPrefix + version;
|
let tag;
|
||||||
|
if (major === 0 || patch !== 0) {
|
||||||
|
// Always tag pre-release/major version 0 as full version
|
||||||
|
tag = `${tagPrefix}${major}.${minor}.${patch}`;
|
||||||
|
} else if (minor !== 0) {
|
||||||
|
tag = `${tagPrefix}${major}.${minor}`;
|
||||||
|
} else {
|
||||||
|
tag = `${tagPrefix}${major}`;
|
||||||
|
}
|
||||||
|
|
||||||
const repository = process.env.GITHUB_REPOSITORY;
|
const repository = process.env.GITHUB_REPOSITORY;
|
||||||
|
|
||||||
core.info(`Version is ${major}.${minor}.${patch}+${increment}`);
|
core.info(`Version is ${major}.${minor}.${patch}+${increment}`);
|
||||||
if (repository !== undefined) {
|
if (repository !== undefined && !namespace) {
|
||||||
core.info(`To create a release for this version, go to https://github.com/${repository}/releases/new?tag=${tag}&target=${branch.split('/').reverse()[0]}`);
|
core.info(`To create a release for this version, go to https://github.com/${repository}/releases/new?tag=${tag}&target=${branch.split('/').reverse()[0]}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
core.setOutput("version", version);
|
core.setOutput("version", version);
|
||||||
core.setOutput("major", major.toString());
|
core.setOutput("major", major.toString());
|
||||||
core.setOutput("minor", minor.toString());
|
core.setOutput("minor", minor.toString());
|
||||||
core.setOutput("patch", patch.toString());
|
core.setOutput("patch", patch.toString());
|
||||||
core.setOutput("increment", increment.toString());
|
core.setOutput("increment", increment.toString());
|
||||||
core.setOutput("changed", changed.toString());
|
core.setOutput("changed", changed.toString());
|
||||||
|
core.setOutput("version_tag", tag);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
async function run() {
|
async function run() {
|
||||||
|
|
|
||||||
15
index.js
15
index.js
|
|
@ -36,20 +36,31 @@ const setOutput = (major, minor, patch, increment, changed, branch, namespace) =
|
||||||
version += `-${namespace}`
|
version += `-${namespace}`
|
||||||
}
|
}
|
||||||
|
|
||||||
const tag = tagPrefix + version;
|
let tag;
|
||||||
|
if (major === 0 || patch !== 0) {
|
||||||
|
// Always tag pre-release/major version 0 as full version
|
||||||
|
tag = `${tagPrefix}${major}.${minor}.${patch}`;
|
||||||
|
} else if (minor !== 0) {
|
||||||
|
tag = `${tagPrefix}${major}.${minor}`;
|
||||||
|
} else {
|
||||||
|
tag = `${tagPrefix}${major}`;
|
||||||
|
}
|
||||||
|
|
||||||
const repository = process.env.GITHUB_REPOSITORY;
|
const repository = process.env.GITHUB_REPOSITORY;
|
||||||
|
|
||||||
core.info(`Version is ${major}.${minor}.${patch}+${increment}`);
|
core.info(`Version is ${major}.${minor}.${patch}+${increment}`);
|
||||||
if (repository !== undefined) {
|
if (repository !== undefined && !namespace) {
|
||||||
core.info(`To create a release for this version, go to https://github.com/${repository}/releases/new?tag=${tag}&target=${branch.split('/').reverse()[0]}`);
|
core.info(`To create a release for this version, go to https://github.com/${repository}/releases/new?tag=${tag}&target=${branch.split('/').reverse()[0]}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
core.setOutput("version", version);
|
core.setOutput("version", version);
|
||||||
core.setOutput("major", major.toString());
|
core.setOutput("major", major.toString());
|
||||||
core.setOutput("minor", minor.toString());
|
core.setOutput("minor", minor.toString());
|
||||||
core.setOutput("patch", patch.toString());
|
core.setOutput("patch", patch.toString());
|
||||||
core.setOutput("increment", increment.toString());
|
core.setOutput("increment", increment.toString());
|
||||||
core.setOutput("changed", changed.toString());
|
core.setOutput("changed", changed.toString());
|
||||||
|
core.setOutput("version_tag", tag);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
async function run() {
|
async function run() {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue