mirror of
https://github.com/docker/metadata-action.git
synced 2025-07-03 17:08:24 +02:00
Add tag flavor
This commit is contained in:
34
dist/index.js
generated
vendored
34
dist/index.js
generated
vendored
@ -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;
|
||||
|
Reference in New Issue
Block a user