Add tag flavor

This commit is contained in:
Hugo Peixoto
2020-11-18 04:17:31 +00:00
parent 9de4428611
commit 94c31d2fed
6 changed files with 285 additions and 10 deletions

34
dist/index.js generated vendored
View File

@ -32,7 +32,9 @@ function getInputs() {
tagSchedule: core.getInput('tag-schedule') || 'nightly',
sepTags: core.getInput('sep-tags') || `\n`,
sepLabels: core.getInput('sep-labels') || `\n`,
githubToken: core.getInput('github-token')
githubToken: core.getInput('github-token'),
flavor: core.getInput('flavor'),
mainFlavor: /true/i.test(core.getInput('main-flavor') || 'true')
};
}
exports.getInputs = getInputs;
@ -255,18 +257,40 @@ class Meta {
if (!this.version.main) {
return [];
}
let flavor = this.inputs.flavor;
let main = !flavor || this.inputs.mainFlavor;
let tags = [];
for (const image of this.inputs.images) {
const imageLc = image.toLowerCase();
tags.push(`${imageLc}:${this.version.main}`);
if (main) {
tags.push(`${imageLc}:${this.version.main}`);
}
if (flavor) {
tags.push(`${imageLc}:${this.version.main}-${flavor}`);
}
for (const partial of this.version.partial) {
tags.push(`${imageLc}:${partial}`);
if (main) {
tags.push(`${imageLc}:${partial}`);
}
if (flavor) {
tags.push(`${imageLc}:${partial}-${flavor}`);
}
}
if (this.version.latest) {
tags.push(`${imageLc}:latest`);
if (main) {
tags.push(`${imageLc}:latest`);
}
if (flavor) {
tags.push(`${imageLc}:${flavor}`);
}
}
if (this.context.sha && this.inputs.tagSha) {
tags.push(`${imageLc}:sha-${this.context.sha.substr(0, 7)}`);
if (main) {
tags.push(`${imageLc}:sha-${this.context.sha.substr(0, 7)}`);
}
if (flavor) {
tags.push(`${imageLc}:sha-${this.context.sha.substr(0, 7)}-${flavor}`);
}
}
}
return tags;