mirror of
https://github.com/docker/build-push-action.git
synced 2025-04-19 09:56:46 +00:00
Test GitHub Cache
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
parent
5003e0df3d
commit
22acf7cb32
10 changed files with 54626 additions and 51 deletions
17
src/main.ts
17
src/main.ts
|
@ -1,6 +1,8 @@
|
|||
import * as os from 'os';
|
||||
import * as buildx from './buildx';
|
||||
import {Inputs, getInputs, getArgs} from './context';
|
||||
import * as github from './github';
|
||||
import * as stateHelper from './state-helper';
|
||||
import * as core from '@actions/core';
|
||||
import * as exec from '@actions/exec';
|
||||
|
||||
|
@ -16,7 +18,7 @@ async function run(): Promise<void> {
|
|||
return;
|
||||
}
|
||||
|
||||
const inputs: Inputs = await getInputs();
|
||||
let inputs: Inputs = await getInputs();
|
||||
const args: string[] = await getArgs(inputs);
|
||||
|
||||
if (inputs.builder) {
|
||||
|
@ -24,6 +26,8 @@ async function run(): Promise<void> {
|
|||
await buildx.use(inputs.builder);
|
||||
}
|
||||
|
||||
inputs = await github.restoreCache(inputs);
|
||||
|
||||
core.info(`🏃 Starting build...`);
|
||||
await exec.exec('docker', args);
|
||||
} catch (error) {
|
||||
|
@ -31,4 +35,13 @@ async function run(): Promise<void> {
|
|||
}
|
||||
}
|
||||
|
||||
run();
|
||||
async function post(): Promise<void> {
|
||||
const inputs: Inputs = await getInputs();
|
||||
await github.saveCache(inputs);
|
||||
}
|
||||
|
||||
if (!stateHelper.IsPost) {
|
||||
run();
|
||||
} else {
|
||||
post();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue