Warn on invalid semver (#22)

Co-authored-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax
2020-12-01 05:50:39 +01:00
committed by GitHub
parent ef12c77b87
commit 4c2760ba7a
4 changed files with 38 additions and 2 deletions

4
dist/index.js generated vendored
View File

@ -171,6 +171,7 @@ exports.Meta = void 0;
const handlebars = __webpack_require__(7492);
const moment = __webpack_require__(9623);
const semver = __webpack_require__(1383);
const core = __webpack_require__(2186);
class Meta {
constructor(inputs, context, repo) {
this.inputs = inputs;
@ -198,6 +199,9 @@ class Meta {
}
else if (/^refs\/tags\//.test(this.context.ref)) {
version.main = this.context.ref.replace(/^refs\/tags\//g, '').replace(/\//g, '-');
if (this.inputs.tagSemver.length > 0 && !semver.valid(version.main)) {
core.warning(`${version.main} is not a valid semver. More info: https://semver.org/`);
}
if (this.inputs.tagSemver.length > 0 && semver.valid(version.main)) {
const sver = semver.parse(version.main, {
includePrerelease: true