Skip to content

Commit 949b928

Browse files
authored
Merge pull request #11 from sourcetoad/register-v-deploy
Register vs Deploy
2 parents 3e9d84d + 4df0d54 commit 949b928

File tree

2 files changed

+23
-5
lines changed

2 files changed

+23
-5
lines changed

action.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ inputs:
3333
codedeploy_group:
3434
description: 'AWS CodeDeploy Application Group'
3535
required: true
36+
codedeploy_register_only:
37+
description: 'Whether to register the deployment (vs automatic deploy).'
38+
required: false
39+
default: 'false'
3640
max_polling_iterations:
3741
description: 'Max amount of iterations (15s increments) to wait for a deployment'
3842
required: false

deploy.sh

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,24 @@ function deployRevision() {
8181
--s3-location bucket="$INPUT_S3_BUCKET",bundleType=zip,eTag="$ZIP_ETAG",key="$INPUT_S3_FOLDER"/"$ZIP_FILENAME" > /dev/null 2>&1
8282
}
8383

84-
echo -e "$BLUE Deploying to $NO_COLOR$INPUT_CODEDEPLOY_GROUP.";
85-
deployRevision
84+
function registerRevision() {
85+
aws deploy register-application-revision \
86+
--application-name "$INPUT_CODEDEPLOY_NAME" \
87+
--description "$GITHUB_REF - $GITHUB_SHA" \
88+
--s3-location bucket="$INPUT_S3_BUCKET",bundleType=zip,eTag="$ZIP_ETAG",key="$INPUT_S3_FOLDER"/"$ZIP_FILENAME" > /dev/null 2>&1
89+
}
90+
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
96+
echo -e "$BLUE Deploying to $NO_COLOR$INPUT_CODEDEPLOY_GROUP.";
97+
deployRevision
98+
99+
sleep 10;
100+
pollForActiveDeployments
101+
echo -e "$GREEN Deployed to $NO_COLOR$INPUT_CODEDEPLOY_GROUP!";
102+
fi
86103

87-
sleep 10;
88-
pollForActiveDeployments
89-
echo -e "$GREEN Deployed to $NO_COLOR$INPUT_CODEDEPLOY_GROUP!";
90104
exit 0;

0 commit comments

Comments
 (0)