From f9ddc94e2725547382c5686894e601fcdbfc2b04 Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Tue, 20 Oct 2020 22:29:53 +0200 Subject: [PATCH] Group log output Signed-off-by: CrazyMax --- dist/index.js | 14 ++++++++++---- src/main.ts | 14 ++++++++++---- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/dist/index.js b/dist/index.js index a4c339d..87539b8 100644 --- a/dist/index.js +++ b/dist/index.js @@ -515,7 +515,9 @@ function run() { const inputs = yield context.getInputs(); const dockerConfigHome = process.env.DOCKER_CONFIG || path.join(os.homedir(), '.docker'); if (!(yield buildx.isAvailable()) || inputs.version) { + core.startGroup(`👉 Installing Buildx`); yield buildx.install(inputs.version || 'latest', dockerConfigHome); + core.endGroup(); } const buildxVersion = yield buildx.getVersion(); core.info(`📣 Buildx version: ${buildxVersion}`); @@ -523,7 +525,7 @@ function run() { core.setOutput('name', builderName); stateHelper.setBuilderName(builderName); if (inputs.driver !== 'docker') { - core.info('🔨 Creating a new builder instance...'); + core.startGroup(`🔨 Creating a new builder instance`); let createArgs = ['buildx', 'create', '--name', builderName, '--driver', inputs.driver]; if (semver.satisfies(buildxVersion, '>=0.3.0')) { let hasImageDriverOpt = false; @@ -548,17 +550,21 @@ function run() { createArgs.push(inputs.endpoint); } yield exec.exec('docker', createArgs); - core.info('🏃 Booting builder...'); + core.endGroup(); + core.startGroup(`🏃 Booting builder`); yield exec.exec('docker', ['buildx', 'inspect', '--bootstrap']); + core.endGroup(); } if (inputs.install) { - core.info('🤝 Setting buildx as default builder...'); + core.startGroup(`🤝 Setting buildx as default builder`); yield exec.exec('docker', ['buildx', 'install']); + core.endGroup(); } - core.info('🛒 Extracting available platforms...'); + core.startGroup(`🛒 Extracting available platforms`); const platforms = yield buildx.platforms(); core.info(`${platforms}`); core.setOutput('platforms', platforms); + core.endGroup(); } catch (error) { core.setFailed(error.message); diff --git a/src/main.ts b/src/main.ts index 109af68..0dfe761 100644 --- a/src/main.ts +++ b/src/main.ts @@ -19,7 +19,9 @@ async function run(): Promise { const dockerConfigHome: string = process.env.DOCKER_CONFIG || path.join(os.homedir(), '.docker'); if (!(await buildx.isAvailable()) || inputs.version) { + core.startGroup(`👉 Installing Buildx`); await buildx.install(inputs.version || 'latest', dockerConfigHome); + core.endGroup(); } const buildxVersion = await buildx.getVersion(); @@ -31,7 +33,7 @@ async function run(): Promise { stateHelper.setBuilderName(builderName); if (inputs.driver !== 'docker') { - core.info('🔨 Creating a new builder instance...'); + core.startGroup(`🔨 Creating a new builder instance`); let createArgs: Array = ['buildx', 'create', '--name', builderName, '--driver', inputs.driver]; if (semver.satisfies(buildxVersion, '>=0.3.0')) { let hasImageDriverOpt: boolean = false; @@ -56,20 +58,24 @@ async function run(): Promise { createArgs.push(inputs.endpoint); } await exec.exec('docker', createArgs); + core.endGroup(); - core.info('🏃 Booting builder...'); + core.startGroup(`🏃 Booting builder`); await exec.exec('docker', ['buildx', 'inspect', '--bootstrap']); + core.endGroup(); } if (inputs.install) { - core.info('🤝 Setting buildx as default builder...'); + core.startGroup(`🤝 Setting buildx as default builder`); await exec.exec('docker', ['buildx', 'install']); + core.endGroup(); } - core.info('🛒 Extracting available platforms...'); + core.startGroup(`🛒 Extracting available platforms`); const platforms = await buildx.platforms(); core.info(`${platforms}`); core.setOutput('platforms', platforms); + core.endGroup(); } catch (error) { core.setFailed(error.message); }