From 4131560d6340e6bb57e1b0da9ff51a93554c8631 Mon Sep 17 00:00:00 2001 From: Giulio Micheloni Date: Sat, 27 Jan 2024 00:49:26 +0100 Subject: [PATCH] try with separate core group --- dist/main/index.js | 16 +++++++++------- main.ts | 18 ++++++++++-------- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/dist/main/index.js b/dist/main/index.js index b1d2b73..df04dcf 100644 --- a/dist/main/index.js +++ b/dist/main/index.js @@ -7100,15 +7100,17 @@ function run() { _actions_core__WEBPACK_IMPORTED_MODULE_0__.info(`Namespace Cloud CLI found.`); } yield _actions_exec__WEBPACK_IMPORTED_MODULE_2__.exec("nsc version"); - const registry = yield _actions_core__WEBPACK_IMPORTED_MODULE_0__.group(`Log into Namespace workspace`, () => __awaiter(this, void 0, void 0, function* () { + yield _actions_core__WEBPACK_IMPORTED_MODULE_0__.group(`Log into Namespace workspace`, () => __awaiter(this, void 0, void 0, function* () { yield ensureNscloudToken(); - const isDockerLogin = process.env[Env_DockerLogin]; - const reg = process.env[Env_DockerRegistry]; - if (isDockerLogin != null && reg != null && isDockerLogin == "1" && reg != "") { - return reg; - } - return yield dockerLogin(); })); + const isDockerLogin = process.env[Env_DockerLogin]; + let registry = process.env[Env_DockerRegistry]; + if (isDockerLogin == null || registry == null || isDockerLogin != "1" || registry == "") { + registry = yield _actions_core__WEBPACK_IMPORTED_MODULE_0__.group(`Log into Namespace workspace container registry`, () => __awaiter(this, void 0, void 0, function* () { + yield ensureNscloudToken(); + return yield dockerLogin(); + })); + } yield _actions_core__WEBPACK_IMPORTED_MODULE_0__.group(`Registry address`, () => __awaiter(this, void 0, void 0, function* () { _actions_core__WEBPACK_IMPORTED_MODULE_0__.info(registry); _actions_core__WEBPACK_IMPORTED_MODULE_0__.setOutput("registry-address", registry); diff --git a/main.ts b/main.ts index 8820d75..1d59544 100644 --- a/main.ts +++ b/main.ts @@ -21,17 +21,19 @@ async function run(): Promise { } await exec.exec("nsc version"); - const registry = await core.group(`Log into Namespace workspace`, async () => { + await core.group(`Log into Namespace workspace`, async () => { await ensureNscloudToken(); - const isDockerLogin = process.env[Env_DockerLogin]; - const reg = process.env[Env_DockerRegistry]; - if (isDockerLogin != null && reg != null && isDockerLogin == "1" && reg != "") { - return reg; - } - - return await dockerLogin(); }); + const isDockerLogin = process.env[Env_DockerLogin]; + let registry = process.env[Env_DockerRegistry]; + if (isDockerLogin == null || registry == null || isDockerLogin != "1" || registry == "") { + registry = await core.group(`Log into Namespace workspace container registry`, async () => { + await ensureNscloudToken(); + return await dockerLogin(); + }); + } + await core.group(`Registry address`, async () => { core.info(registry); core.setOutput("registry-address", registry);