mirror of
https://code.forgejo.org/docker/build-push-action.git
synced 2025-08-05 17:00:58 +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
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue