Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ Following inputs can be used as `step.with` keys
| `directory` | No | String | Directory to archive. Defaults to root of project. |
| `archive` | No | String | Zip to deploy. Defaults to empty (thus ignored) |
| `max_polling_iterations` | No | Number | Number of 15s iterations to poll max. (default: `60`) |
| `dry_run` | No | Boolean | If true, no connection to AWS is made. Just local zip creation. |

## Archive or Build
Some projects may have a complex build system or even build the archive in a previous step. This is where
Expand Down
4 changes: 4 additions & 0 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ inputs:
description: 'Max amount of iterations (15s increments) to wait for a deployment'
required: false
default: '60'
dry_run:
description: 'Whether to skip all AWS related steps.'
required: false
default: 'false'
runs:
using: 'docker'
image: 'Dockerfile'
Expand Down
15 changes: 10 additions & 5 deletions deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,27 @@ ORANGE='\033[0;33m'
BLUE='\033[0;34m'

# 0) Validation
if [ -z "$INPUT_CODEDEPLOY_NAME" ]; then
if [ -z "$INPUT_CODEDEPLOY_NAME" ] && [ -z "$INPUT_DRY_RUN" ]; then
echo "::error::codedeploy_name is required and must not be empty."
exit 1;
fi

if [ -z "$INPUT_CODEDEPLOY_GROUP" ]; then
if [ -z "$INPUT_CODEDEPLOY_GROUP" ] && [ -z "$INPUT_DRY_RUN" ]; then
echo "::error::codedeploy_group is required and must not be empty."
exit 1;
fi

if [ -z "$INPUT_AWS_ACCESS_KEY" ]; then
if [ -z "$INPUT_AWS_ACCESS_KEY" ] && [ -z "$INPUT_DRY_RUN" ]; then
echo "::error::aws_access_key is required and must not be empty."
exit 1;
fi

if [ -z "$INPUT_AWS_SECRET_KEY" ]; then
if [ -z "$INPUT_AWS_SECRET_KEY" ] && [ -z "$INPUT_DRY_RUN" ]; then
echo "::error::aws_secret_key is required and must not be empty."
exit 1;
fi

if [ -z "$INPUT_S3_BUCKET" ]; then
if [ -z "$INPUT_S3_BUCKET" ] && [ -z "$INPUT_DRY_RUN" ]; then
echo "::error::s3_bucket is required and must not be empty."
exit 1;
fi
Expand Down Expand Up @@ -93,6 +93,11 @@ function getArchiveETag() {
--query ETag --output text
}

if "$INPUT_DRY_RUN"; then
echo "::debug::Dry Run detected. Exiting."
exit 0;
fi

aws s3 cp "$ZIP_FILENAME" s3://"$INPUT_S3_BUCKET"/"$INPUT_S3_FOLDER"/"$ZIP_FILENAME"

echo "::debug::Zip uploaded to S3."
Expand Down