Skip to content

Commit ce47dd7

Browse files
committed
Update action.yml and main.ts files
1 parent 174a265 commit ce47dd7

File tree

5 files changed

+42
-169
lines changed

5 files changed

+42
-169
lines changed

action.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,10 @@ inputs:
3131

3232
# Define your outputs here.
3333
outputs:
34-
time:
35-
description: 'Your output description here'
34+
deploymentId:
35+
description: 'The ID of the deployment'
36+
status:
37+
description: 'The status of the deployment'
3638

3739
runs:
3840
using: node20

dist/index.js

Lines changed: 19 additions & 82 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/findLambdas.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import * as core from '@actions/core'
12
import {
23
GetFunctionCommand,
34
LambdaClient,
@@ -7,9 +8,7 @@ import {
78
GetResourcesCommand,
89
ResourceGroupsTaggingAPI
910
} from '@aws-sdk/client-resource-groups-tagging-api'
10-
import * as core from '@actions/core'
1111
import z from 'zod'
12-
import util from 'util'
1312

1413
const LambdaFunctionDTOSchema = z.object({
1514
Configuration: z.object({

src/main.ts

Lines changed: 17 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -59,24 +59,27 @@ const deployApplication = async (
5959
return
6060
}
6161

62-
const input: DeployInput = {
63-
applicationName: data.applicationName,
64-
deploymentGroupName: data.deploymentGroupName,
65-
deploymentConfigName: data.deploymentConfigName,
66-
description: data.description,
67-
revision: {
68-
revisionType: 'AppSpecContent',
69-
appSpecContent: {
70-
content: JSON.stringify({
71-
version: '0.0.1',
72-
Resources: resources
73-
})
62+
for (const resource of resources) {
63+
const input: DeployInput = {
64+
applicationName: data.applicationName,
65+
deploymentGroupName: data.deploymentGroupName,
66+
deploymentConfigName: data.deploymentConfigName,
67+
description: data.description,
68+
revision: {
69+
revisionType: 'AppSpecContent',
70+
appSpecContent: {
71+
content: JSON.stringify({
72+
version: '0.0.1',
73+
Resources: [resource]
74+
})
75+
}
7476
}
7577
}
78+
79+
await deploy(input)
7680
}
7781

78-
await deploy(input)
79-
core.info('Deployment triggered:')
82+
core.info('Deployments triggered:')
8083
lambdas.forEach(lambda => {
8184
core.info(
8285
` - ${lambda.name}: ${lambda.aliasVersion} -> ${lambda.latestVersion}`
@@ -97,71 +100,3 @@ const fromLambdaFunctionToResource = (
97100
}
98101
}
99102
}
100-
101-
// {
102-
// "version": "0.0",
103-
// "Resources":[{
104-
// "blue":{
105-
// "Type": "AWS::Lambda::Function",
106-
// "Properties":{
107-
// "Name":"blue",
108-
// "Alias":"Blue",
109-
// "CurrentVersion":2,
110-
// "TargetVersion": 1
111-
// }
112-
// }
113-
// },
114-
// {
115-
// "blue":{
116-
// "Type": "AWS::Lambda::Function",
117-
// "Properties":{
118-
// "Name":"blue",
119-
// "Alias":"Blue",
120-
// "CurrentVersion":2,
121-
// "TargetVersion": 1
122-
// }
123-
// }
124-
// }]
125-
// }
126-
127-
// {
128-
// "applicationName": "Test",
129-
// "deploymentGroupName": "Test",
130-
// "revision": {
131-
// "revisionType": "AppSpecContent",
132-
// "appSpecContent": {
133-
// "content": "{\"version\":\"0.0\",\"Resources\":[{\"blue\":{\"Type\":\"AWS::Lambda::Function\",\"Properties\":{\"Name\":\"blue\",\"Alias\":\"Blue\",\"CurrentVersion\":2,\"TargetVersion\":1}}}]}"
134-
// }
135-
// },
136-
// "deploymentConfigName": "CodeDeployDefault.LambdaAllAtOnce"
137-
// }
138-
139-
// # {
140-
// # "applicationName": "",
141-
// # "deploymentGroupName": "",
142-
// # "revision": {
143-
// # "revisionType": "AppSpecContent",
144-
// # "appSpecContent": {
145-
// # "content": ""
146-
// # }
147-
// # },
148-
// # "deploymentConfigName": "",
149-
// # "description": "",
150-
// # "ignoreApplicationStopFailures": true,
151-
// # "autoRollbackConfiguration": {
152-
// # "enabled": true,
153-
// # "events": [
154-
// # "DEPLOYMENT_FAILURE"
155-
// # ]
156-
// # },
157-
// # "updateOutdatedInstancesOnly": true,
158-
// # "overrideAlarmConfiguration": {
159-
// # "enabled": true,
160-
// # "ignorePollAlarmFailure": true,
161-
// # "alarms": [
162-
// # {
163-
// # "name": ""
164-
// # }
165-
// # ]
166-
// # }
167-
// # }

0 commit comments

Comments
 (0)