1
0
Fork 0
mirror of https://github.com/docker/setup-buildx-action.git synced 2025-04-23 08:26:38 +02:00

Enhance workflow

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax 2021-04-02 01:19:14 +02:00
parent f0d07f4abd
commit cb02c5f3d1
No known key found for this signature in database
GPG key ID: 3248E46B6BB8C7F7
15 changed files with 184 additions and 149 deletions

View file

@ -52,7 +52,7 @@ export async function install(inputVersion: string, dockerConfigHome: string): P
if (!release) {
throw new Error(`Cannot find buildx ${inputVersion} release`);
}
core.debug(`Release found: ${release.tag_name}`);
core.debug(`Release ${release.tag_name} found`);
const version = release.tag_name.replace(/^v+|v+$/g, '');
let toolPath: string;
@ -76,7 +76,7 @@ export async function install(inputVersion: string, dockerConfigHome: string): P
core.debug(`Plugin path is ${pluginPath}`);
fs.copyFileSync(path.join(toolPath, filename), pluginPath);
core.info('🔨 Fixing perms...');
core.info('Fixing perms');
fs.chmodSync(pluginPath, '0755');
return pluginPath;
@ -92,7 +92,7 @@ async function download(version: string): Promise<string> {
let downloadPath: string;
try {
core.info(`⬇️ Downloading ${downloadUrl}...`);
core.info(`Downloading ${downloadUrl}`);
downloadPath = await tc.downloadTool(downloadUrl);
core.debug(`Downloaded to ${downloadPath}`);
} catch (error) {

View file

@ -19,20 +19,20 @@ async function run(): Promise<void> {
const dockerConfigHome: string = process.env.DOCKER_CONFIG || path.join(os.homedir(), '.docker');
if (!(await buildx.isAvailable()) || inputs.version) {
core.startGroup(`👉 Installing Buildx`);
core.startGroup(`Installing buildx`);
await buildx.install(inputs.version || 'latest', dockerConfigHome);
core.endGroup();
}
const buildxVersion = await buildx.getVersion();
core.info(`📣 Buildx version: ${buildxVersion}`);
core.info(`Using buildx ${buildxVersion}`);
const builderName: string = inputs.driver == 'docker' ? 'default' : `builder-${require('uuid').v4()}`;
core.setOutput('name', builderName);
stateHelper.setBuilderName(builderName);
if (inputs.driver !== 'docker') {
core.startGroup(`🔨 Creating a new builder instance`);
core.startGroup(`Creating a new builder instance`);
let createArgs: Array<string> = ['buildx', 'create', '--name', builderName, '--driver', inputs.driver];
if (semver.satisfies(buildxVersion, '>=0.3.0')) {
await context.asyncForEach(inputs.driverOpts, async driverOpt => {
@ -51,7 +51,7 @@ async function run(): Promise<void> {
await exec.exec('docker', createArgs);
core.endGroup();
core.startGroup(`🏃 Booting builder`);
core.startGroup(`Booting builder`);
let bootstrapArgs: Array<string> = ['buildx', 'inspect', '--bootstrap'];
if (semver.satisfies(buildxVersion, '>=0.4.0')) {
bootstrapArgs.push('--builder', builderName);
@ -61,12 +61,12 @@ async function run(): Promise<void> {
}
if (inputs.install) {
core.startGroup(`🤝 Setting buildx as default builder`);
core.startGroup(`Setting buildx as default builder`);
await exec.exec('docker', ['buildx', 'install']);
core.endGroup();
}
core.startGroup(`🛒 Extracting available platforms`);
core.startGroup(`Extracting available platforms`);
const platforms = await buildx.platforms();
core.info(`${platforms}`);
core.setOutput('platforms', platforms);