From ca533bf426caa3f22195284072d095eed7048c34 Mon Sep 17 00:00:00 2001 From: Adam Kubon Date: Fri, 1 Mar 2024 12:58:19 +0000 Subject: [PATCH] gcp-profile-handling --- .gitignore | 1 + dist/main/index.js | 10 ++++++++-- src/main.ts | 10 ++++++++-- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 8503cbcd..eeb56103 100644 --- a/.gitignore +++ b/.gitignore @@ -94,3 +94,4 @@ typings/ # Skip the lib folder lib/ +.idea/ \ No newline at end of file diff --git a/dist/main/index.js b/dist/main/index.js index 4cd3831e..62806178 100644 --- a/dist/main/index.js +++ b/dist/main/index.js @@ -4026,10 +4026,16 @@ function setup() { const inputs = getInputs(); if (inputs != null) { try { - const { signingKey, awsAccessKeyId, awsSecretAccessKey, skipPush, } = inputs; + const { signingKey, awsAccessKeyId, awsSecretAccessKey, skipPush, endpoint,} = inputs; // for managed signing key and private caches if (awsAccessKeyId !== "" && awsSecretAccessKey !== "") { - const aws_credentials = `[default] + let aws_credentials; + let profile = 'default' + const regex = 'profile=(\\w+)'; + if (endpoint !== "undefined" && endpoint?.match(regex)) { + profile = endpoint?.match(regex)[1]; + } + aws_credentials = `[${profile}] aws_access_key_id = ${awsAccessKeyId} aws_secret_access_key = ${awsSecretAccessKey}`; const aws_path = path.join(os.homedir(), ".aws"); diff --git a/src/main.ts b/src/main.ts index f8637883..20565eb7 100644 --- a/src/main.ts +++ b/src/main.ts @@ -38,14 +38,20 @@ async function setup() { awsAccessKeyId, awsSecretAccessKey, skipPush, + endpoint, } = inputs; // for managed signing key and private caches if (awsAccessKeyId !== "" && awsSecretAccessKey !== "") { - const aws_credentials = `[default] + let aws_credentials; + let profile = 'default' + const regex = 'profile=(\\w+)'; + if (endpoint === null && endpoint.match(regex)) { + profile = endpoint.match(regex)[1]; + } + aws_credentials = `[${profile}] aws_access_key_id = ${awsAccessKeyId} aws_secret_access_key = ${awsSecretAccessKey}`; - const aws_path = path.join(os.homedir(), ".aws"); const aws_credentials_path = path.join(aws_path, "credentials");