From 67bc18b3314ebdc9d05050ee3a7a3114427debf6 Mon Sep 17 00:00:00 2001 From: Adam Kubon Date: Fri, 1 Mar 2024 12:58:19 +0000 Subject: [PATCH] gcp-profile-handling --- .github/workflows/test.yml | 1 + .gitignore | 1 + dist/main/index.js | 10 ++++++++-- src/main.ts | 10 ++++++++-- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0248cabb..42419754 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -4,6 +4,7 @@ on: push: branches: - master + - feature/gcp-profile-handling jobs: public-cache: 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..8f493400 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..f97c5533 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 !== "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"); const aws_credentials_path = path.join(aws_path, "credentials");