Skip to content

Commit 9eff7cf

Browse files
committed
Turning variables into optional
Make template file optional adding default value Make capabilites configurable
1 parent 4f27619 commit 9eff7cf

File tree

2 files changed

+29
-4
lines changed

2 files changed

+29
-4
lines changed

README.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,27 @@ jobs:
1616
runs-on: ubuntu-latest
1717
steps:
1818
- uses: actions/checkout@v1
19-
- uses: mgenteluci/cloudformation-deploy-action@v1
19+
- uses: mgenteluci/cloudformation-deploy-action@v1.1.0
2020
env:
2121
TEMPLATE: 'template.yml'
22+
CAPABILITIES: 'CAPABILITY_IAM'
2223
AWS_STACK_NAME: 'my-stack'
2324
AWS_REGION: 'us-east-1'
2425
AWS_ACCESS_KEY_ID: ${{secrets.AWS_ACCESS_KEY_ID}}
2526
AWS_SECRET_ACCESS_KEY: ${{secrets.AWS_SECRET_ACCESS_KEY}}
2627
AWS_DEPLOY_BUCKET: ${{secrets.AWS_DEPLOY_BUCKET}}
2728
```
29+
30+
### Environment Variables
31+
32+
* `TEMPLATE` - [Optional]. YML file containing CloudFormation Stack. Default to `template.yml`.
33+
* `CAPABILITIES` - [Optional]. AWS Stack Capabilites. Default to `CAPABILITY_IAM`.
34+
* `AWS_STACK_NAME` - [**Required**]. The Stack name that is going to be published.
35+
* `AWS_REGION` - [**Required**]. AWS Region where to deploy the CloudFormation Stack.
36+
* `AWS_ACCESS_KEY_ID` - [**Required**]. AWS Access Key Id.
37+
* `AWS_SECRET_ACCESS_KEY` - [**Required**]. AWS Secret Access Key.
38+
* `AWS_DEPLOY_BUCKET` - [**Required**]. AWS S3 Bucket where the Stack package is going to be stored.
39+
40+
### License
41+
42+
The Dockerfile and associated scripts and documentation in this project are released under the [MIT License](LICENSE).

entrypoint.sh

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,14 @@
33
set -e
44

55
if [[ -z "$TEMPLATE" ]]; then
6-
echo Empty template specified
7-
exit 1
6+
echo Empty template specified. Searching template.yml...
7+
8+
if [[ ! -f "template.yml" ]]; then
9+
echo default template.yml not found
10+
exit 1
11+
fi
12+
13+
TEMPLATE="template.yml"
814
fi
915

1016
if [[ -z "$AWS_STACK_NAME" ]]; then
@@ -32,6 +38,10 @@ if [[ -z "$AWS_DEPLOY_BUCKET" ]]; then
3238
exit 1
3339
fi
3440

41+
if [[ -z "$CAPABILITIES" ]]; then
42+
CAPABILITIES=CAPABILITY_IAM
43+
fi
44+
3545
mkdir ~/.aws
3646
touch ~/.aws/credentials
3747
touch ~/.aws/config
@@ -46,4 +56,4 @@ output = text
4656
region = $AWS_REGION" > ~/.aws/config
4757

4858
aws cloudformation package --template-file $TEMPLATE --output-template-file serverless-output.yaml --s3-bucket $AWS_DEPLOY_BUCKET
49-
aws cloudformation deploy --template-file serverless-output.yaml --stack-name $AWS_STACK_NAME --capabilities CAPABILITY_IAM
59+
aws cloudformation deploy --template-file serverless-output.yaml --stack-name $AWS_STACK_NAME --capabilities $CAPABILITIES

0 commit comments

Comments
 (0)