Skip to content

Commit 9c56b43

Browse files
committed
feat: skip aws steps if dry_run enabled
1 parent baed3ef commit 9c56b43

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

deploy.sh

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,27 @@ ORANGE='\033[0;33m'
88
BLUE='\033[0;34m'
99

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

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

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

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

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

96+
if "$INPUT_DRY_RUN"; then
97+
echo "::debug::Dry Run detected. Exiting."
98+
exit 0;
99+
fi
100+
96101
aws s3 cp "$ZIP_FILENAME" s3://"$INPUT_S3_BUCKET"/"$INPUT_S3_FOLDER"/"$ZIP_FILENAME"
97102

98103
echo "::debug::Zip uploaded to S3."

0 commit comments

Comments
 (0)