Skip to content

Commit

Permalink
Merge pull request #1 from MGenteluci/v1.2.0
Browse files Browse the repository at this point in the history
v1.2.0
  • Loading branch information
MGenteluci authored Aug 24, 2019
2 parents 58da399 + 90ba303 commit 0257d18
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 8 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# IDE
.vscode
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM ubuntu

LABEL version="0.0.1"
LABEL version="1.0.0"

LABEL com.github.actions.name="CloudFormation Deploy Action"
LABEL com.github.actions.description="Deploy AWS CloudFormation Stack"
Expand Down
22 changes: 18 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: mgenteluci/cloudformation-deploy-action@v1.1.0
- uses: mgenteluci/cloudformation-deploy-action@v1.2.0
env:
TEMPLATE: 'template.yml'
CAPABILITIES: 'CAPABILITY_IAM'
AWS_STACK_NAME: 'my-stack'
AWS_REGION: 'us-east-1'
AWS_ACCESS_KEY_ID: ${{secrets.AWS_ACCESS_KEY_ID}}
Expand All @@ -29,13 +28,28 @@ jobs:
### Environment Variables
* `TEMPLATE` - [Optional]. YML file containing CloudFormation Stack. Default to `template.yml`.
* `CAPABILITIES` - [Optional]. AWS Stack Capabilites. Default to `CAPABILITY_IAM`.
* `TEMPLATE` - [Optional]. YML file containing CloudFormation Stack.
* Type: `String`
* Default: `template.yml`
* `CAPABILITIES` - [Optional]. AWS Stack Capabilites.
* Type: `String`
* Default: `CAPABILITY_IAM`
* `AWS_STACK_NAME` - [**Required**]. The Stack name that is going to be published.
* Type: `String`
* `AWS_REGION` - [**Required**]. AWS Region where to deploy the CloudFormation Stack.
* Type: `String`
* `AWS_ACCESS_KEY_ID` - [**Required**]. AWS Access Key Id.
* Type: `String`
* `AWS_SECRET_ACCESS_KEY` - [**Required**]. AWS Secret Access Key.
* Type: `String`
* `AWS_DEPLOY_BUCKET` - [**Required**]. AWS S3 Bucket where the Stack package is going to be stored.
* Type: `String`
* `AWS_BUCKET_PREFIX` - [Optional]. S3 Bucket's folder where to upload the package.
* Type: `String`
* `FORCE_UPLOAD` - [Optional]. Whether to override existing packages in case they are an exact match.
* Type: `Boolean`
* `USE_JSON` - [Optional]. Whether to use JSON instead of YML as the output template format.
* Type: `Boolean`

### Examples

Expand Down
18 changes: 15 additions & 3 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
set -e

if [[ -z "$TEMPLATE" ]]; then
echo Empty template specified. Searching template.yml...
echo "Empty template specified. Looking for template.yml..."

if [[ ! -f "template.yml" ]]; then
echo default template.yml not found
echo template.yml not found
exit 1
fi

Expand Down Expand Up @@ -38,6 +38,18 @@ if [[ -z "$AWS_DEPLOY_BUCKET" ]]; then
exit 1
fi

if [[ ! -z "$AWS_BUCKET_PREFIX" ]]; then
AWS_BUCKET_PREFIX="--s3-prefix ${AWS_BUCKET_PREFIX}"
fi

if [[ $FORCE_UPLOAD == true ]]; then
FORCE_UPLOAD="--force-upload"
fi

if [[ $USE_JSON == true ]]; then
USE_JSON="--use-json"
fi

if [[ -z "$CAPABILITIES" ]]; then
CAPABILITIES=CAPABILITY_IAM
fi
Expand All @@ -55,5 +67,5 @@ echo "[default]
output = text
region = $AWS_REGION" > ~/.aws/config

aws cloudformation package --template-file $TEMPLATE --output-template-file serverless-output.yaml --s3-bucket $AWS_DEPLOY_BUCKET
aws cloudformation package --template-file $TEMPLATE --output-template-file serverless-output.yaml --s3-bucket $AWS_DEPLOY_BUCKET $AWS_BUCKET_PREFIX $FORCE_UPLOAD $USE_JSON
aws cloudformation deploy --template-file serverless-output.yaml --stack-name $AWS_STACK_NAME --capabilities $CAPABILITIES

0 comments on commit 0257d18

Please sign in to comment.