diff --git a/src/index.ts b/src/index.ts index 38a35af..d66b341 100644 --- a/src/index.ts +++ b/src/index.ts @@ -15,7 +15,8 @@ import { Inputs } from "./generated/inputs-outputs"; let podmanPath: string | undefined; let registry: string; -const dockerConfigPath = path.join(os.homedir(), ".docker", "config.json"); +const dockerConfigDir = path.join(os.homedir(), ".docker"); +const dockerConfigPath = path.join(dockerConfigDir, "config.json"); async function getPodmanPath(): Promise { if (podmanPath == null) { @@ -91,7 +92,8 @@ async function run(): Promise { dockerConfig.auths[registry] = generatedAuth; - await fs.writeFile(dockerConfigPath, JSON.stringify(dockerConfig, undefined, 8), "utf-8"); + await fs.mkdir(dockerConfigDir, {recursive: true}) + .then(() => fs.writeFile(dockerConfigPath, JSON.stringify(dockerConfig, undefined, 8), "utf-8")); } async function registryLogout(): Promise {