Skip to content

Commit 5ac6b7e

Browse files
committed
refactor: use explicit bool
1 parent 135cbf4 commit 5ac6b7e

File tree

2 files changed

+8
-14
lines changed

2 files changed

+8
-14
lines changed

action.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ inputs:
3333
codedeploy_group:
3434
description: 'AWS CodeDeploy Application Group'
3535
required: true
36-
codedeploy_mode:
37-
description: 'Whether to register or deploy revision. Valid ("register" or "deploy")'
36+
codedeploy_register_only:
37+
description: 'Whether to register the deployment (vs automatic deploy).'
3838
required: false
39-
default: 'deploy'
39+
default: 'false'
4040
max_polling_iterations:
4141
description: 'Max amount of iterations (15s increments) to wait for a deployment'
4242
required: false

deploy.sh

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,6 @@ GREEN='\033[0;32m'
77
ORANGE='\033[0;33m'
88
BLUE='\033[0;34m'
99

10-
# 0) Validation
11-
if [ "$INPUT_CODEDEPLOY_MODE" != "deploy" ] && [ "$INPUT_CODEDEPLOY_MODE" != "register" ]; then
12-
echo "::error::$INPUT_CODEDEPLOY_MODE was not 'deploy' or 'register'."
13-
exit 1;
14-
fi
15-
1610
# 1) Load our permissions in for aws-cli
1711
export AWS_ACCESS_KEY_ID=$INPUT_AWS_ACCESS_KEY
1812
export AWS_SECRET_ACCESS_KEY=$INPUT_AWS_SECRET_KEY
@@ -94,17 +88,17 @@ function registerRevision() {
9488
--s3-location bucket="$INPUT_S3_BUCKET",bundleType=zip,eTag="$ZIP_ETAG",key="$INPUT_S3_FOLDER"/"$ZIP_FILENAME" > /dev/null 2>&1
9589
}
9690

97-
if [ "$INPUT_CODEDEPLOY_MODE" = "deploy" ]; then
91+
if $INPUT_CODEDEPLOY_REGISTER_ONLY; then
92+
echo -e "$BLUE Registering deployment to $NO_COLOR$INPUT_CODEDEPLOY_GROUP.";
93+
registerRevision
94+
echo -e "$BLUE Registered deployment to $NO_COLOR$INPUT_CODEDEPLOY_GROUP!";
95+
else
9896
echo -e "$BLUE Deploying to $NO_COLOR$INPUT_CODEDEPLOY_GROUP.";
9997
deployRevision
10098

10199
sleep 10;
102100
pollForActiveDeployments
103101
echo -e "$GREEN Deployed to $NO_COLOR$INPUT_CODEDEPLOY_GROUP!";
104-
else
105-
echo -e "$BLUE Registering deployment to $NO_COLOR$INPUT_CODEDEPLOY_GROUP.";
106-
registerRevision
107-
echo -e "$BLUE Registered deployment to $NO_COLOR$INPUT_CODEDEPLOY_GROUP!";
108102
fi
109103

110104
exit 0;

0 commit comments

Comments
 (0)