mirror of
https://github.com/docker/build-push-action.git
synced 2025-04-19 01:46:45 +00:00
chore: update dev dependencies and workflow
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
parent
ac9327eae2
commit
2d081a4fd5
16 changed files with 2706 additions and 29647 deletions
|
@ -76,8 +76,8 @@ export async function getSecret(kvp: string, file: boolean): Promise<string> {
|
|||
return `id=${key},src=${secretFile}`;
|
||||
}
|
||||
|
||||
export function isLocalOrTarExporter(outputs: string[]): Boolean {
|
||||
for (let output of csvparse(outputs.join(`\n`), {
|
||||
export function isLocalOrTarExporter(outputs: string[]): boolean {
|
||||
for (const output of csvparse(outputs.join(`\n`), {
|
||||
delimiter: ',',
|
||||
trim: true,
|
||||
columns: false,
|
||||
|
@ -88,7 +88,7 @@ export function isLocalOrTarExporter(outputs: string[]): Boolean {
|
|||
if (output.length == 1 && !output[0].startsWith('type=')) {
|
||||
return true;
|
||||
}
|
||||
for (let [key, value] of output.map(chunk => chunk.split('=').map(item => item.trim()))) {
|
||||
for (const [key, value] of output.map(chunk => chunk.split('=').map(item => item.trim()))) {
|
||||
if (key == 'type' && (value == 'local' || value == 'tar')) {
|
||||
return true;
|
||||
}
|
||||
|
@ -97,8 +97,8 @@ export function isLocalOrTarExporter(outputs: string[]): Boolean {
|
|||
return false;
|
||||
}
|
||||
|
||||
export function hasGitAuthToken(secrets: string[]): Boolean {
|
||||
for (let secret of secrets) {
|
||||
export function hasGitAuthToken(secrets: string[]): boolean {
|
||||
for (const secret of secrets) {
|
||||
if (secret.startsWith('GIT_AUTH_TOKEN=')) {
|
||||
return true;
|
||||
}
|
||||
|
@ -106,7 +106,7 @@ export function hasGitAuthToken(secrets: string[]): Boolean {
|
|||
return false;
|
||||
}
|
||||
|
||||
export async function isAvailable(): Promise<Boolean> {
|
||||
export async function isAvailable(): Promise<boolean> {
|
||||
return await exec
|
||||
.getExecOutput('docker', ['buildx'], {
|
||||
ignoreReturnCode: true,
|
||||
|
|
|
@ -99,15 +99,17 @@ export async function getInputs(defaultContext: string): Promise<Inputs> {
|
|||
}
|
||||
|
||||
export async function getArgs(inputs: Inputs, defaultContext: string, buildxVersion: string): Promise<Array<string>> {
|
||||
let args: Array<string> = ['buildx'];
|
||||
args.push.apply(args, await getBuildArgs(inputs, defaultContext, buildxVersion));
|
||||
args.push.apply(args, await getCommonArgs(inputs, buildxVersion));
|
||||
args.push(handlebars.compile(inputs.context)({defaultContext}));
|
||||
return args;
|
||||
// prettier-ignore
|
||||
return [
|
||||
'buildx',
|
||||
...await getBuildArgs(inputs, defaultContext, buildxVersion),
|
||||
...await getCommonArgs(inputs, buildxVersion),
|
||||
handlebars.compile(inputs.context)({defaultContext})
|
||||
];
|
||||
}
|
||||
|
||||
async function getBuildArgs(inputs: Inputs, defaultContext: string, buildxVersion: string): Promise<Array<string>> {
|
||||
let args: Array<string> = ['build'];
|
||||
const args: Array<string> = ['build'];
|
||||
await asyncForEach(inputs.addHosts, async addHost => {
|
||||
args.push('--add-host', addHost);
|
||||
});
|
||||
|
@ -182,7 +184,7 @@ async function getBuildArgs(inputs: Inputs, defaultContext: string, buildxVersio
|
|||
}
|
||||
|
||||
async function getCommonArgs(inputs: Inputs, buildxVersion: string): Promise<Array<string>> {
|
||||
let args: Array<string> = [];
|
||||
const args: Array<string> = [];
|
||||
if (inputs.builder) {
|
||||
args.push('--builder', inputs.builder);
|
||||
}
|
||||
|
@ -208,14 +210,14 @@ async function getCommonArgs(inputs: Inputs, buildxVersion: string): Promise<Arr
|
|||
}
|
||||
|
||||
export async function getInputList(name: string, ignoreComma?: boolean): Promise<string[]> {
|
||||
let res: Array<string> = [];
|
||||
const res: Array<string> = [];
|
||||
|
||||
const items = core.getInput(name);
|
||||
if (items == '') {
|
||||
return res;
|
||||
}
|
||||
|
||||
for (let output of (await csvparse(items, {
|
||||
for (const output of (await csvparse(items, {
|
||||
columns: false,
|
||||
relax: true,
|
||||
relaxColumnCount: true,
|
||||
|
@ -241,6 +243,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);
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ async function run(): Promise<void> {
|
|||
|
||||
const buildxVersion = await buildx.getVersion();
|
||||
const defContext = context.defaultContext();
|
||||
let inputs: context.Inputs = await context.getInputs(defContext);
|
||||
const inputs: context.Inputs = await context.getInputs(defContext);
|
||||
|
||||
const args: string[] = await context.getArgs(inputs, defContext, buildxVersion);
|
||||
await exec
|
||||
|
@ -29,7 +29,7 @@ async function run(): Promise<void> {
|
|||
})
|
||||
.then(res => {
|
||||
if (res.stderr.length > 0 && res.exitCode != 0) {
|
||||
throw new Error(`buildx failed with: ${res.stderr.match(/(.*)\s*$/)![0].trim()}`);
|
||||
throw new Error(`buildx failed with: ${res.stderr.match(/(.*)\s*$/)?.[0]?.trim() ?? 'unknown error'}`);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue