Skip to content

Commit

Permalink
Merge pull request #7 from sean-smith/backend-arn-optional
Browse files Browse the repository at this point in the history
Don't require Backend Environment ARN
  • Loading branch information
yinlinchen committed Sep 17, 2020
2 parents 32ecfec + 5ed633f commit c97f8a4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ The following settings must be passed as environment variables as shown in the e
| `AWS_SECRET_ACCESS_KEY` | Your AWS Secret Access Key. [More info here.](https://docs.aws.amazon.com/general/latest/gr/managing-aws-access-keys.html) | `secret env` | **Yes** | N/A |
| `AWS_REGION` | The region where you created your bucket. Set to `us-east-1` by default. [Full list of regions here.](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html#concepts-available-regions) | `env` | **Yes** | `us-east-1` |
| `AmplifyAppId` | The unique ID for an Amplify app. For example, `d6a88fjhifqlks` | `secret env` | **Yes** | N/A |
| `BackendEnvARN` | The Amazon Resource Name (ARN) for a backend environment that is part of an Amplify app. | `secret env` | **Yes** | N/A |
| `BackendEnvARN` | The Amazon Resource Name (ARN) for a backend environment that is part of the Amplify app. If the Amplify App has no backend environment, don't set it. | `secret env` | **No** | N/A |
| `GITHUB_TOKEN` | The `GITHUB_TOKEN`, should be supplied if a comment with the preview URL is to be posted on the PR. GitHub automatically creates a `GITHUB_TOKEN` secret to use in your workflow. You can use it directly, see [About the GITHUB_TOKEN secret](https://docs.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token#about-the-github_token-secret) | `github env` | No | N/A |
| `NewBackendEnvARN` | The Amazon Resource Name (ARN) for a backend environment that is part of an Amplify app. | `secret env` | No | N/A |

Expand Down
9 changes: 5 additions & 4 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ if [ -z "$AmplifyAppId" ] ; then
exit 1
fi

if [ -z "$BackendEnvARN" ] ; then
echo "You must provide BackendEnvARN environment variable in order to deploy"
exit 1
if [[ ! -z "$BackendEnvARN" ]] ; then
backend_env_arg="--backend-environment-arn=${BackendEnvARN}"
else
backend_env_arg=""
fi

if [ -z "$BRANCH_NAME" ] ; then
Expand All @@ -46,7 +47,7 @@ case $AMPLIFY_COMMAND in

deploy)
sh -c "aws amplify create-branch --app-id=${AmplifyAppId} --branch-name=$BRANCH_NAME \
--backend-environment-arn=${BackendEnvARN} --region=${AWS_REGION}"
${backend_env_arg} --region=${AWS_REGION}"

sleep 10

Expand Down

0 comments on commit c97f8a4

Please sign in to comment.