mirror of
https://github.com/redhat-actions/podman-login.git
synced 2025-02-23 10:31:21 +01:00
Don't fail on missing ~/.docker
dir
This is a follow-up to 8828a2343e
/ #39
This commit is contained in:
parent
4934294ad0
commit
913e9b2934
1 changed files with 4 additions and 2 deletions
|
@ -15,7 +15,8 @@ import { Inputs } from "./generated/inputs-outputs";
|
||||||
|
|
||||||
let podmanPath: string | undefined;
|
let podmanPath: string | undefined;
|
||||||
let registry: string;
|
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<string> {
|
async function getPodmanPath(): Promise<string> {
|
||||||
if (podmanPath == null) {
|
if (podmanPath == null) {
|
||||||
|
@ -91,7 +92,8 @@ async function run(): Promise<void> {
|
||||||
|
|
||||||
dockerConfig.auths[registry] = generatedAuth;
|
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<void> {
|
async function registryLogout(): Promise<void> {
|
||||||
|
|
Loading…
Add table
Reference in a new issue