diff --git a/dev-portal/README.md b/dev-portal/README.md index bf0191eb8..bb2b58b2f 100644 --- a/dev-portal/README.md +++ b/dev-portal/README.md @@ -30,6 +30,9 @@ module.exports = { // Set this to overwrite-content if you want to reset your custom content back to the defaults. Defaults to `` // staticAssetRebuildMode: `overwrite-content` // ONLY SET + + // AWS SAM CLI profile option: optional specific profile from your AWS credential file. Not used by default + //awsSamCliProfile: "my-profile" } ``` 4. Run `npm run release`. This will build the static assets, deploy them, and generate the `dev-portal/public/config.js` file needed for local development. Take note of the bucket names you use diff --git a/dev-portal/scripts/deploy-stack.js b/dev-portal/scripts/deploy-stack.js index 20155c4e3..90220df84 100644 --- a/dev-portal/scripts/deploy-stack.js +++ b/dev-portal/scripts/deploy-stack.js @@ -21,15 +21,19 @@ const customersTableName = deployerConfig.customersTableName || 'DevPortalCustom const cognitoDomainName = deployerConfig.cognitoDomainName || '' const staticAssetRebuildMode = deployerConfig.staticAssetRebuildMode || '' +// AWS SAM CLI configuration +const awsSamCliProfile = deployerConfig.awsSamCliProfile; +const profileOption = awsSamCliProfile ? `--profile ${awsSamCliProfile}` : '' + function main() { Promise.resolve() - .then(() => execute(`sam package --template-file ${samTemplate} --output-template-file ${packageConfig} --s3-bucket ${buildAssetsBucket}`, true)) - .then(() => execute(`sam deploy --template-file ${packageConfig} --stack-name ${stackName} --capabilities CAPABILITY_NAMED_IAM --parameter-overrides StaticAssetRebuildToken="${Date.now()}" StaticAssetRebuildMode="${staticAssetRebuildMode}" DevPortalSiteS3BucketName="${siteAssetsBucket}" ArtifactsS3BucketName="${apiAssetsBucket}" DevPortalCustomersTableName="${customersTableName}" CognitoDomainNameOrPrefix="${cognitoDomainName}" --s3-bucket ${buildAssetsBucket}`, true)) - .then(() => writeConfig(true)) - .then(() => console.log('\n' + 'Process Complete! Run `npm run start` to launch run the dev portal locally.\n'.green())) - .catch(err => { - console.log(("" + err).red()) - }) + .then(() => execute(`sam package --template-file ${samTemplate} --output-template-file ${packageConfig} --s3-bucket ${buildAssetsBucket} ${profileOption}`, true)) +.then(() => execute(`sam deploy --template-file ${packageConfig} --stack-name ${stackName} --capabilities CAPABILITY_NAMED_IAM --parameter-overrides StaticAssetRebuildToken="${Date.now()}" StaticAssetRebuildMode="${staticAssetRebuildMode}" DevPortalSiteS3BucketName="${siteAssetsBucket}" ArtifactsS3BucketName="${apiAssetsBucket}" DevPortalCustomersTableName="${customersTableName}" CognitoDomainNameOrPrefix="${cognitoDomainName}" --s3-bucket ${buildAssetsBucket} ${profileOption}`, true)) +.then(() => writeConfig(true)) +.then(() => console.log('\n' + 'Process Complete! Run `npm run start` to launch run the dev portal locally.\n'.green())) +.catch(err => { + console.log(("" + err).red()) + }) } if (samTemplate && packageConfig && stackName && buildAssetsBucket && siteAssetsBucket && apiAssetsBucket && customersTableName) {