Skip to content

Commit

Permalink
gcp-profile-handling
Browse files Browse the repository at this point in the history
  • Loading branch information
adamkubon committed Mar 5, 2024
1 parent d124825 commit ca533bf
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,4 @@ typings/

# Skip the lib folder
lib/
.idea/
10 changes: 8 additions & 2 deletions dist/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
10 changes: 8 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down

0 comments on commit ca533bf

Please sign in to comment.