mirror of
https://github.com/docker/build-push-action.git
synced 2025-04-20 18:26:46 +00:00
Remove os limitation
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
parent
4cef7b9d89
commit
d619a7ff00
7 changed files with 63 additions and 25 deletions
21
src/main.ts
21
src/main.ts
|
@ -1,5 +1,4 @@
|
|||
import * as fs from 'fs';
|
||||
import * as os from 'os';
|
||||
import * as buildx from './buildx';
|
||||
import * as context from './context';
|
||||
import * as exec from './exec';
|
||||
|
@ -8,22 +7,24 @@ import * as core from '@actions/core';
|
|||
|
||||
async function run(): Promise<void> {
|
||||
try {
|
||||
if (os.platform() !== 'linux') {
|
||||
throw new Error(`Only supported on linux platform`);
|
||||
}
|
||||
core.startGroup(`Docker info`);
|
||||
await exec.exec('docker', ['version']);
|
||||
await exec.exec('docker', ['info']);
|
||||
core.endGroup();
|
||||
|
||||
if (!(await buildx.isAvailable())) {
|
||||
throw new Error(`Buildx is required. See https://github.com/docker/setup-buildx-action to set up buildx.`);
|
||||
core.setFailed(`Docker buildx is required. See https://github.com/docker/setup-buildx-action to set up buildx.`);
|
||||
return;
|
||||
}
|
||||
stateHelper.setTmpDir(context.tmpDir());
|
||||
|
||||
const buildxVersion = await buildx.getVersion();
|
||||
core.info(`📣 Buildx version: ${buildxVersion}`);
|
||||
core.info(`Using buildx ${buildxVersion}`);
|
||||
|
||||
const defContext = context.defaultContext();
|
||||
let inputs: context.Inputs = await context.getInputs(defContext);
|
||||
|
||||
core.info(`🏃 Starting build...`);
|
||||
core.info(`Building...`);
|
||||
const args: string[] = await context.getArgs(inputs, defContext, buildxVersion);
|
||||
await exec.exec('docker', args).then(res => {
|
||||
if (res.stderr != '' && !res.success) {
|
||||
|
@ -33,9 +34,10 @@ async function run(): Promise<void> {
|
|||
|
||||
const imageID = await buildx.getImageID();
|
||||
if (imageID) {
|
||||
core.info('🛒 Extracting digest...');
|
||||
core.startGroup(`Extracting digest`);
|
||||
core.info(`${imageID}`);
|
||||
core.setOutput('digest', imageID);
|
||||
core.endGroup();
|
||||
}
|
||||
} catch (error) {
|
||||
core.setFailed(error.message);
|
||||
|
@ -44,8 +46,9 @@ async function run(): Promise<void> {
|
|||
|
||||
async function cleanup(): Promise<void> {
|
||||
if (stateHelper.tmpDir.length > 0) {
|
||||
core.info(`🚿 Removing temp folder ${stateHelper.tmpDir}`);
|
||||
core.startGroup(`Removing temp folder ${stateHelper.tmpDir}`);
|
||||
fs.rmdirSync(stateHelper.tmpDir, {recursive: true});
|
||||
core.endGroup();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue