mirror of
https://git.flexiblyrigid.au/actions/bake-action.git
synced 2025-12-06 15:58:07 +08:00
chore: update dev dependencies and workflow
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
@@ -21,7 +21,7 @@ export async function getMetadata(): Promise<string | undefined> {
|
||||
return content;
|
||||
}
|
||||
|
||||
export async function isAvailable(): Promise<Boolean> {
|
||||
export async function isAvailable(): Promise<boolean> {
|
||||
return await exec
|
||||
.getExecOutput('docker', ['buildx'], {
|
||||
ignoreReturnCode: true,
|
||||
|
||||
@@ -45,15 +45,17 @@ export async function getInputs(): Promise<Inputs> {
|
||||
}
|
||||
|
||||
export async function getArgs(inputs: Inputs, buildxVersion: string): Promise<Array<string>> {
|
||||
let args: Array<string> = ['buildx'];
|
||||
args.push.apply(args, await getBakeArgs(inputs, buildxVersion));
|
||||
args.push.apply(args, await getCommonArgs(inputs));
|
||||
args.push.apply(args, inputs.targets);
|
||||
return args;
|
||||
// prettier-ignore
|
||||
return [
|
||||
'buildx',
|
||||
...await getBakeArgs(inputs, buildxVersion),
|
||||
...await getCommonArgs(inputs),
|
||||
...inputs.targets
|
||||
];
|
||||
}
|
||||
|
||||
async function getBakeArgs(inputs: Inputs, buildxVersion: string): Promise<Array<string>> {
|
||||
let args: Array<string> = ['bake'];
|
||||
const args: Array<string> = ['bake'];
|
||||
await asyncForEach(inputs.files, async file => {
|
||||
args.push('--file', file);
|
||||
});
|
||||
@@ -67,7 +69,7 @@ async function getBakeArgs(inputs: Inputs, buildxVersion: string): Promise<Array
|
||||
}
|
||||
|
||||
async function getCommonArgs(inputs: Inputs): Promise<Array<string>> {
|
||||
let args: Array<string> = [];
|
||||
const args: Array<string> = [];
|
||||
if (inputs.noCache) {
|
||||
args.push('--no-cache');
|
||||
}
|
||||
@@ -87,14 +89,14 @@ async function getCommonArgs(inputs: Inputs): Promise<Array<string>> {
|
||||
}
|
||||
|
||||
export function getInputList(name: string, ignoreComma?: boolean): string[] {
|
||||
let res: Array<string> = [];
|
||||
const res: Array<string> = [];
|
||||
|
||||
const items = core.getInput(name);
|
||||
if (items == '') {
|
||||
return res;
|
||||
}
|
||||
|
||||
for (let output of csvparse(items, {
|
||||
for (const output of csvparse(items, {
|
||||
columns: false,
|
||||
relaxColumnCount: true,
|
||||
skipLinesWithEmptyValues: true
|
||||
@@ -119,6 +121,6 @@ export const asyncForEach = async (array, callback) => {
|
||||
};
|
||||
|
||||
// FIXME: Temp fix https://github.com/actions/toolkit/issues/777
|
||||
export function setOutput(name: string, value: any): void {
|
||||
export function setOutput(name: string, value: unknown): void {
|
||||
issueCommand('set-output', {name}, value);
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ async function run(): Promise<void> {
|
||||
})
|
||||
.then(res => {
|
||||
if (res.stderr.length > 0 && res.exitCode != 0) {
|
||||
throw new Error(`buildx bake failed with: ${res.stderr.match(/(.*)\s*$/)![0].trim()}`);
|
||||
throw new Error(`buildx bake failed with: ${res.stderr.match(/(.*)\s*$/)?.[0]?.trim() ?? 'unknown error'}`);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user