Skip to content

Commit

Permalink
Merge pull request #16 from jwarykowski/feat/environment-variables
Browse files Browse the repository at this point in the history
feat: environment variables support
  • Loading branch information
yinlinchen committed Apr 14, 2023
2 parents 6aa9b8f + d27292f commit 824ad2d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
AmplifyAppId: ${{ secrets.AMPLIFYAPPID }}
BackendEnvARN: ${{ secrets.BACKENDENVARN }}
EnvironmentVariables: 'key1=value,key2=value'
AWS_REGION: 'us-east-1'
```
Expand All @@ -59,6 +60,7 @@ The following settings must be passed as environment variables as shown in the e
| `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 the Amplify app. If the Amplify App has no backend environment, don't set it. | `secret env` | **No** | N/A |
| `EnvironmentVariables` | The environment variables for the branch. | `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
8 changes: 7 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ else
backend_env_arg=""
fi

if [[ ! -z "$EnvironmentVariables" ]] ; then
environment_variables_arg="--environment-variables=${EnvironmentVariables}"
else
environment_variables_arg=""
fi

if [ -z "$BRANCH_NAME" ] ; then
echo "You must provide branch name input parameter in order to deploy"
exit 1
Expand All @@ -47,7 +53,7 @@ case $AMPLIFY_COMMAND in

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

sleep 10

Expand Down

0 comments on commit 824ad2d

Please sign in to comment.