Skip to content

Commit ebef158

Browse files
authored
Fix the 'deploymentGroupCreated' output (#4)
1 parent 9046ced commit ebef158

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,9 @@ This workaround should catch a good share of possible out-of-order deployments.
169169

170170
* `deploymentId`: AWS CodeDeployment Deployment-ID of the deployment created
171171
* `deploymentGroupName`: AWS CodeDeployment Deployment Group name used
172-
* `deploymentGroupCreated`: True, if a new deployment group was created. False, if an existing group was updated.
172+
* `deploymentGroupCreated`: `1`, if a new deployment group was created; `0` if an existing group was updated.
173+
174+
You can use the expression `if: steps.<your-deployment-step>.outputs.deploymentGroupCreated==true` (or `...==false`) on subsequent workflow steps to run actions only if the deployment created a new deployment group (or updated an existing deployment, respectively).
173175

174176
## Hacking
175177

create-deployment.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ exports.createDeployment = async function(applicationName, fullRepositoryName, b
4444
}
4545
}).promise();
4646
console.log(`⚙️ Updated deployment group '${deploymentGroupName}'`);
47-
core.setOutput('deploymentGroupCreated', false);
47+
48+
core.setOutput('deploymentGroupCreated', 0);
4849
} catch (e) {
4950
if (e.code == 'DeploymentGroupDoesNotExistException') {
5051
await codeDeploy.createDeploymentGroup({
@@ -55,7 +56,8 @@ exports.createDeployment = async function(applicationName, fullRepositoryName, b
5556
}
5657
}).promise();
5758
console.log(`🎯 Created deployment group '${deploymentGroupName}'`);
58-
core.setOutput('deploymentGroupCreated', true);
59+
60+
core.setOutput('deploymentGroupCreated', 1);
5961
} else {
6062
core.setFailed(`🌩 Unhandled exception`);
6163
throw e;

dist/index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ exports.createDeployment = async function(applicationName, fullRepositoryName, b
6060
}
6161
}).promise();
6262
console.log(`⚙️ Updated deployment group '${deploymentGroupName}'`);
63-
core.setOutput('deploymentGroupCreated', false);
63+
64+
core.setOutput('deploymentGroupCreated', 0);
6465
} catch (e) {
6566
if (e.code == 'DeploymentGroupDoesNotExistException') {
6667
await codeDeploy.createDeploymentGroup({
@@ -71,7 +72,8 @@ exports.createDeployment = async function(applicationName, fullRepositoryName, b
7172
}
7273
}).promise();
7374
console.log(`🎯 Created deployment group '${deploymentGroupName}'`);
74-
core.setOutput('deploymentGroupCreated', true);
75+
76+
core.setOutput('deploymentGroupCreated', 1);
7577
} else {
7678
core.setFailed(`🌩 Unhandled exception`);
7779
throw e;

0 commit comments

Comments
 (0)