From c0e6909db2c0a9cb0ba45ab5e2478d331cdaf950 Mon Sep 17 00:00:00 2001 From: Matheus Genteluci Date: Fri, 23 Aug 2019 21:31:59 -0300 Subject: [PATCH 1/3] Readme, Env Variables, Log Changes log message in template.yml search Add optional AWS_BUCKET_PREFIX environment variable Update README Add optional FORCE_UPLOAD environment variable Add optional USE_JSON environment variable --- Dockerfile | 2 +- README.md | 20 +++++++++++++++++--- entrypoint.sh | 18 +++++++++++++++--- 3 files changed, 33 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index b1a41ac..b09c9bb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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" diff --git a/README.md b/README.md index 3fc2cd3..efaee7b 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,6 @@ jobs: - uses: mgenteluci/cloudformation-deploy-action@v1.1.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}} @@ -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]. S3 Bucket's folder where to upload the package. + * Type: `Boolean` ### Examples diff --git a/entrypoint.sh b/entrypoint.sh index db5bd01..a070836 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -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 @@ -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 @@ -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 From 3d5702f4c3f555aea3c944ca9dc9a3f4a63cb09a Mon Sep 17 00:00:00 2001 From: Matheus Genteluci Date: Fri, 23 Aug 2019 21:34:55 -0300 Subject: [PATCH 2/3] v1.2.0 Fix USE_JSON description --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index efaee7b..7179821 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ jobs: * Type: `String` * `FORCE_UPLOAD` - [Optional]. Whether to override existing packages in case they are an exact match. * Type: `Boolean` -* `USE_JSON` - [Optional]. S3 Bucket's folder where to upload the package. +* `USE_JSON` - [Optional]. Whether to use JSON instead of YML as the output template format. * Type: `Boolean` ### Examples From 90ba303f2557128af82acd0028be29901ac1cdd5 Mon Sep 17 00:00:00 2001 From: Matheus Genteluci Date: Fri, 23 Aug 2019 21:59:14 -0300 Subject: [PATCH 3/3] Add .vscode to gitignore --- .gitignore | 2 ++ README.md | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9310a5f --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +# IDE +.vscode diff --git a/README.md b/README.md index 7179821..c5139d6 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ 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' AWS_STACK_NAME: 'my-stack'