feat: allow the `images` input to be empty, to output just tags
Signed-off-by: Jason D'Amour <jasondamour98@gmail.com>
This commit is contained in:
parent
051f7ea71b
commit
aacea38e07
|
@ -15,10 +15,6 @@ actionsToolkit.run(
|
||||||
// main
|
// main
|
||||||
async () => {
|
async () => {
|
||||||
const inputs: Inputs = getInputs();
|
const inputs: Inputs = getInputs();
|
||||||
if (inputs.images.length == 0) {
|
|
||||||
throw new Error(`images input required`);
|
|
||||||
}
|
|
||||||
|
|
||||||
const toolkit = new Toolkit({githubToken: inputs.githubToken});
|
const toolkit = new Toolkit({githubToken: inputs.githubToken});
|
||||||
const context = await getContext(inputs.context);
|
const context = await getContext(inputs.context);
|
||||||
const repo = await toolkit.github.repoData();
|
const repo = await toolkit.github.repoData();
|
||||||
|
|
15
src/meta.ts
15
src/meta.ts
|
@ -441,7 +441,9 @@ export class Meta {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
const tags: Array<string> = [];
|
const tags: Array<string> = [];
|
||||||
for (const imageName of this.getImageNames()) {
|
const images = this.getImageNames();
|
||||||
|
if (Array.isArray(images) && images.length) {
|
||||||
|
for (const imageName of images) {
|
||||||
tags.push(`${imageName}:${this.version.main}`);
|
tags.push(`${imageName}:${this.version.main}`);
|
||||||
for (const partial of this.version.partial) {
|
for (const partial of this.version.partial) {
|
||||||
tags.push(`${imageName}:${partial}`);
|
tags.push(`${imageName}:${partial}`);
|
||||||
|
@ -451,6 +453,17 @@ export class Meta {
|
||||||
tags.push(`${imageName}:${Meta.sanitizeTag(latestTag)}`);
|
tags.push(`${imageName}:${Meta.sanitizeTag(latestTag)}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
tags.push(this.version.main);
|
||||||
|
for (const partial of this.version.partial) {
|
||||||
|
tags.push(partial);
|
||||||
|
}
|
||||||
|
if (this.version.latest) {
|
||||||
|
const latestTag = `${this.flavor.prefixLatest ? this.flavor.prefix : ''}latest${this.flavor.suffixLatest ? this.flavor.suffix : ''}`;
|
||||||
|
tags.push(Meta.sanitizeTag(latestTag));
|
||||||
|
}
|
||||||
|
}
|
||||||
return tags;
|
return tags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue