mirror of
https://github.com/docker/build-push-action.git
synced 2025-04-19 18:06:46 +00:00
Add secrets input
Use Git as default context Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
parent
bd6a01893d
commit
f295fbf080
11 changed files with 13571 additions and 299 deletions
22
src/main.ts
22
src/main.ts
|
@ -1,6 +1,8 @@
|
|||
import * as fs from 'fs';
|
||||
import * as os from 'os';
|
||||
import * as buildx from './buildx';
|
||||
import {Inputs, getInputs, getArgs} from './context';
|
||||
import * as context from './context';
|
||||
import * as stateHelper from './state-helper';
|
||||
import * as core from '@actions/core';
|
||||
import * as exec from '@actions/exec';
|
||||
|
||||
|
@ -15,18 +17,19 @@ async function run(): Promise<void> {
|
|||
core.setFailed(`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}`);
|
||||
|
||||
let inputs: Inputs = await getInputs();
|
||||
let inputs: context.Inputs = await context.getInputs();
|
||||
if (inputs.builder) {
|
||||
core.info(`📌 Using builder instance ${inputs.builder}`);
|
||||
await buildx.use(inputs.builder);
|
||||
}
|
||||
|
||||
core.info(`🏃 Starting build...`);
|
||||
const args: string[] = await getArgs(inputs, buildxVersion);
|
||||
const args: string[] = await context.getArgs(inputs, buildxVersion);
|
||||
await exec.exec('docker', args);
|
||||
|
||||
const imageID = await buildx.getImageID();
|
||||
|
@ -40,4 +43,15 @@ async function run(): Promise<void> {
|
|||
}
|
||||
}
|
||||
|
||||
run();
|
||||
async function cleanup(): Promise<void> {
|
||||
if (stateHelper.tmpDir.length > 0) {
|
||||
core.info(`🚿 Removing temp folder ${stateHelper.tmpDir}`);
|
||||
fs.rmdirSync(stateHelper.tmpDir, {recursive: true});
|
||||
}
|
||||
}
|
||||
|
||||
if (!stateHelper.IsPost) {
|
||||
run();
|
||||
} else {
|
||||
cleanup();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue