Skip to content
This repository has been archived by the owner on Jan 16, 2023. It is now read-only.

Commit

Permalink
Merge pull request #79 from dandean/dandean/allow-no-aws-profile
Browse files Browse the repository at this point in the history
Make it possible to exclude use of the AWS `--profile` flag
  • Loading branch information
dandean authored Feb 5, 2020
2 parents 59e7627 + 6f4797a commit 9d4e32e
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ This is a simple tool allows you to deploy your Storybook into a static hosting

```sh
$ storybook-to-ghpages --help
$ storybook-to-aws-s3 --help

Options:
--help, -h Show help. [boolean]
Expand All @@ -21,7 +22,8 @@ Options:
--branch Git branch to push to [string] [default: "gh-pages"]
--source-branch Source branch to push from [string] [default: "master"]
--host-token-env-variable, -t Github token for CI publish [string] [default: "GH_TOKEN"]
--aws-profile AWS profile to use for publishing [string] [default: "default"]
--aws-profile AWS profile to use for publishing. Use NONE to use no profile
at all instead of "default". [string] [default: "default"]
--bucket-path AWS bucket path to use for publishing [string]
```

Expand Down Expand Up @@ -182,3 +184,7 @@ You must specify a bucket path with `bucket-path` option: `my-bucket-name/path/t
You can change the aws profile used to run the command with the `aws-profile` option.

example: `storybook-to-aws-s3 --bucket-path=my-bucket-name/path/to/destination-folder-in-bucket --aws-profile=myprofile`

You can exclude the aws profile by setting this flag to "NONE":

example: `storybook-to-aws-s3 --bucket-path=my-bucket-name/path/to/destination-folder-in-bucket --aws-profile=NONE`
7 changes: 6 additions & 1 deletion bin/storybook_to_aws_s3
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,14 @@ if (args.DRY_RUN) {
return;
}

// If a system does not use an AWS profile we have to exclude the flag entirely.
// This is indicated by AWS_PROFILE='NONE'.
const awsProfile =
args.AWS_PROFILE === 'NONE' ? '' : `--profile ${args.AWS_PROFILE}`;

console.log('=> Deploying storybook');
publishUtils.exec(
`aws --profile ${args.AWS_PROFILE} s3 sync ${args.OUTPUT_DIR} ${args.S3_PATH}`
`aws ${awsProfile} s3 sync ${args.OUTPUT_DIR} ${args.S3_PATH}`
);

shell.rm('-rf', args.OUTPUT_DIR);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@storybook/storybook-deployer",
"version": "2.8.1",
"version": "2.8.2",
"description": "Deploy your storybook as a webapp.",
"keywords": [
"deploy",
Expand Down
3 changes: 2 additions & 1 deletion src/parse-args.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ const argv = yargs
})
// AWS Variables
.option('aws-profile', {
desc: 'AWS profile to use for publishing',
desc:
'AWS profile to use for publishing. Use NONE to exclude the --profile flag.',
type: 'string',
default: 'default'
})
Expand Down

0 comments on commit 9d4e32e

Please sign in to comment.