Skip to content

Commit 37aaec7

Browse files
authored
Merge pull request #238 from zmynx/fix/context
fix: update context file in runtime.
2 parents dae46fe + d65f810 commit 37aaec7

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

.github/workflows/cd-serverless.yaml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,14 @@ jobs:
5454
# --notices false \
5555
# --context env=prod
5656

57+
- name: Update context file with new version
58+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
59+
working-directory: serverless/configs
60+
env:
61+
IMAGE_TAG: "${{ format('{0}-lambda', github.event.workflow_run.head_sha) }}"
62+
run: |
63+
yq -i '.imageTag = strenv(IMAGE_TAG)' prod.context.yaml
64+
5765
- name: Synth
5866
env:
5967
CDK_DEFAULT_ACCOUNT: ${{ secrets.AWS_ACCOUNT_ID }}
@@ -62,7 +70,6 @@ jobs:
6270
cdk synth \
6371
--notices false \
6472
--context env=prod \
65-
--context imageTag="${{ github.event_name == 'workflow_run' && format('{0}-lambda', github.event.workflow_run.head_sha) || 'latest-lambda' }}" \
6673
--ci \
6774
--debug \
6875
--verbose \
@@ -206,6 +213,14 @@ jobs:
206213
force-skip-oidc: false
207214
# action-timeout-s: 60
208215

216+
- name: Update context file with new version
217+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
218+
working-directory: serverless/configs
219+
env:
220+
IMAGE_TAG: "${{ format('{0}-lambda', github.event.workflow_run.head_sha) }}"
221+
run: |
222+
yq -i '.imageTag = strenv(IMAGE_TAG)' prod.context.yaml
223+
209224
- name: Deploy
210225
env:
211226
CDK_DEFAULT_ACCOUNT: ${{ secrets.AWS_ACCOUNT_ID }}
@@ -214,7 +229,6 @@ jobs:
214229
cdk deploy \
215230
--notices false \
216231
--context env=prod \
217-
--context imageTag="${{ github.event_name == 'workflow_run' && format('{0}-lambda', github.event.workflow_run.head_sha) || 'latest-lambda' }}" \
218232
--force \
219233
--app dist \
220234
--ci \
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
imageUri: ghcr.io/zmynx/aws-lambda-calculator
2-
imageTag: latest-lambda
2+
imageTag: "2.1.1"

0 commit comments

Comments
 (0)