mirror of
https://github.com/docker/metadata-action.git
synced 2026-01-22 14:39:02 +08:00
feat: add tag-suffix and tag-prefix options
This commit is contained in:
parent
5f29dbc7d7
commit
983af1f9f4
6 changed files with 167 additions and 8 deletions
|
|
@ -18,6 +18,8 @@ export interface Inputs {
|
|||
tagSchedule: string;
|
||||
tagCustom: string[];
|
||||
tagCustomOnly: boolean;
|
||||
tagSuffix: string;
|
||||
tagPrefix: string;
|
||||
labelCustom: string[];
|
||||
sepTags: string;
|
||||
sepLabels: string;
|
||||
|
|
@ -44,6 +46,8 @@ export function getInputs(): Inputs {
|
|||
tagSchedule: core.getInput('tag-schedule') || 'nightly',
|
||||
tagCustom: getInputList('tag-custom'),
|
||||
tagCustomOnly: /true/i.test(core.getInput('tag-custom-only') || 'false'),
|
||||
tagSuffix: core.getInput('tag-suffix'),
|
||||
tagPrefix: core.getInput('tag-prefix'),
|
||||
labelCustom: getInputList('label-custom'),
|
||||
sepTags: core.getInput('sep-tags') || `\n`,
|
||||
sepLabels: core.getInput('sep-labels') || `\n`,
|
||||
|
|
|
|||
|
|
@ -117,15 +117,15 @@ export class Meta {
|
|||
let tags: Array<string> = [];
|
||||
for (const image of this.inputs.images) {
|
||||
const imageLc = image.toLowerCase();
|
||||
tags.push(`${imageLc}:${this.version.main}`);
|
||||
tags.push(`${imageLc}:${this.inputs.tagPrefix}${this.version.main}${this.inputs.tagSuffix}`);
|
||||
for (const partial of this.version.partial) {
|
||||
tags.push(`${imageLc}:${partial}`);
|
||||
tags.push(`${imageLc}:${this.inputs.tagPrefix}${partial}${this.inputs.tagSuffix}`);
|
||||
}
|
||||
if (this.version.latest) {
|
||||
tags.push(`${imageLc}:latest`);
|
||||
tags.push(`${imageLc}:${this.inputs.tagPrefix}latest${this.inputs.tagSuffix}`);
|
||||
}
|
||||
if (this.context.sha && this.inputs.tagSha) {
|
||||
tags.push(`${imageLc}:sha-${this.context.sha.substr(0, 7)}`);
|
||||
tags.push(`${imageLc}:${this.inputs.tagPrefix}sha-${this.context.sha.substr(0, 7)}${this.inputs.tagSuffix}`);
|
||||
}
|
||||
}
|
||||
return tags;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue