Test GitHub Cache

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax 2020-08-16 22:31:37 +02:00
parent 5003e0df3d
commit 22acf7cb32
No known key found for this signature in database
GPG key ID: 3248E46B6BB8C7F7
10 changed files with 54626 additions and 51 deletions

View file

@ -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();
}