mirror of
https://github.com/docker/build-push-action.git
synced 2025-06-14 07:07:12 +02:00
Add secrets input
Use Git as default context Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import tmp from 'tmp';
|
||||
import * as semver from 'semver';
|
||||
import * as context from './context';
|
||||
import * as exec from './exec';
|
||||
@ -16,6 +17,15 @@ export async function getImageID(): Promise<string | undefined> {
|
||||
return fs.readFileSync(iidFile, {encoding: 'utf-8'});
|
||||
}
|
||||
|
||||
export async function getSecret(kvp: string): Promise<string> {
|
||||
const [key, value] = kvp.split('=');
|
||||
const secretFile = tmp.tmpNameSync({
|
||||
tmpdir: context.tmpDir
|
||||
});
|
||||
await fs.writeFileSync(secretFile, value);
|
||||
return `id=${key},src=${secretFile}`;
|
||||
}
|
||||
|
||||
export async function isAvailable(): Promise<Boolean> {
|
||||
return await exec.exec(`docker`, ['buildx'], true).then(res => {
|
||||
if (res.stderr != '' && !res.success) {
|
||||
|
Reference in New Issue
Block a user