chore: update dev dependencies and workflow

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax 2022-03-21 13:43:41 +01:00
parent c62171c994
commit 2e23606dc9
No known key found for this signature in database
GPG key ID: 3248E46B6BB8C7F7
21 changed files with 2134 additions and 16276 deletions

View file

@ -41,7 +41,7 @@ export async function getConfig(s: string, file: boolean): Promise<string> {
return configFile;
}
export async function isAvailable(): Promise<Boolean> {
export async function isAvailable(): Promise<boolean> {
return await exec
.getExecOutput('docker', ['buildx'], {
ignoreReturnCode: true,
@ -134,6 +134,7 @@ export async function inspect(name: string): Promise<Builder> {
}
export async function build(inputBuildRef: string, dockerConfigHome: string): Promise<string> {
// eslint-disable-next-line prefer-const
let [repo, ref] = inputBuildRef.split('#');
if (ref.length == 0) {
ref = 'master';
@ -208,16 +209,9 @@ async function setPlugin(toolPath: string, dockerConfigHome: string): Promise<st
async function download(version: string): Promise<string> {
const targetFile: string = context.osPlat == 'win32' ? 'docker-buildx.exe' : 'docker-buildx';
const downloadUrl = util.format('https://github.com/docker/buildx/releases/download/v%s/%s', version, await filename(version));
let downloadPath: string;
try {
core.info(`Downloading ${downloadUrl}`);
downloadPath = await tc.downloadTool(downloadUrl);
core.debug(`Downloaded to ${downloadPath}`);
} catch (error) {
throw error;
}
core.info(`Downloading ${downloadUrl}`);
const downloadPath = await tc.downloadTool(downloadUrl);
core.debug(`Downloaded to ${downloadPath}`);
return await tc.cacheFile(downloadPath, targetFile, 'buildx', version);
}
@ -233,6 +227,7 @@ async function filename(version: string): Promise<string> {
break;
}
case 'arm': {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const arm_version = (process.config.variables as any).arm_version;
arch = arm_version ? 'arm-v' + arm_version : 'arm';
break;

View file

@ -64,6 +64,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);
}

View file

@ -10,7 +10,7 @@ export async function getRemoteSha(repo: string, ref: string): Promise<string> {
if (res.stderr.length > 0 && res.exitCode != 0) {
throw new Error(res.stderr);
}
const [rsha, rref] = res.stdout.trim().split(/[\s\t]/);
const [rsha] = res.stdout.trim().split(/[\s\t]/);
if (rsha.length == 0) {
throw new Error(`Cannot find remote ref for ${repo}#${ref}`);
}

View file

@ -6,7 +6,7 @@ export interface GitHubRelease {
}
export const getRelease = async (version: string): Promise<GitHubRelease | null> => {
const url: string = `https://github.com/docker/buildx/releases/${version}`;
const url = `https://github.com/docker/buildx/releases/${version}`;
const http: httpm.HttpClient = new httpm.HttpClient('setup-buildx');
return (await http.getJson<GitHubRelease>(url)).result;
};

View file

@ -1,5 +1,6 @@
import * as os from 'os';
import * as path from 'path';
import * as uuid from 'uuid';
import * as buildx from './buildx';
import * as context from './context';
import * as stateHelper from './state-helper';
@ -28,13 +29,13 @@ async function run(): Promise<void> {
}
const buildxVersion = await buildx.getVersion();
const builderName: string = inputs.driver == 'docker' ? 'default' : `builder-${require('uuid').v4()}`;
const builderName: string = inputs.driver == 'docker' ? 'default' : `builder-${uuid.v4()}`;
context.setOutput('name', builderName);
stateHelper.setBuilderName(builderName);
if (inputs.driver !== 'docker') {
core.startGroup(`Creating a new builder instance`);
let createArgs: Array<string> = ['buildx', 'create', '--name', builderName, '--driver', inputs.driver];
const createArgs: Array<string> = ['buildx', 'create', '--name', builderName, '--driver', inputs.driver];
if (buildx.satisfies(buildxVersion, '>=0.3.0')) {
await context.asyncForEach(inputs.driverOpts, async driverOpt => {
createArgs.push('--driver-opt', driverOpt);
@ -58,7 +59,7 @@ async function run(): Promise<void> {
core.endGroup();
core.startGroup(`Booting builder`);
let bootstrapArgs: Array<string> = ['buildx', 'inspect', '--bootstrap'];
const bootstrapArgs: Array<string> = ['buildx', 'inspect', '--bootstrap'];
if (buildx.satisfies(buildxVersion, '>=0.4.0')) {
bootstrapArgs.push('--builder', builderName);
}