28
28
type : string
29
29
default : " ."
30
30
31
-
32
31
jobs :
33
32
check-changes :
34
33
runs-on : ubuntu-latest
35
34
outputs :
36
35
stack_changed : ${{ steps.filter.outputs.stack_changed }}
37
36
steps :
38
37
- name : Checkout
39
- uses : actions/checkout@v2
38
+ uses : actions/checkout@v4
40
39
with :
41
40
fetch-depth : 0 # Important to fetch all history for branches
42
41
- name : Check for changes in the stack based on input
@@ -141,6 +140,7 @@ jobs:
141
140
TERRAFORM_ACTIONS_GITHUB_TOKEN : ${{ steps.generate-token.outputs.token }}
142
141
GITHUB_APP_ID : ${{ secrets.TERRAFORM_GITHUB_ACTION_APP_ID }}
143
142
GITHUB_APP_PEM_FILE : ${{ secrets.TERRAFORM_GITHUB_ACTION_PRIVATE_KEY }}
143
+
144
144
- name : terraform fmt ${{ inputs.stack }}
145
145
uses : dflook/terraform-fmt-check@v1
146
146
with :
@@ -169,6 +169,47 @@ jobs:
169
169
rm -rf .terraform .terraform.lock.hcl
170
170
tofu init -upgrade
171
171
# Build or change infrastructure according to Tofu configuration files
172
+
173
+ - name : Zip Lambda Directories
174
+ run : |
175
+ cd ${{ inputs.stack }}
176
+ find .terraform/modules -mindepth 2 -maxdepth 2 -type d -name 'lambda' | while read lambda_dir; do
177
+ module_dir=$(dirname "$lambda_dir")
178
+ zip_name="$module_dir/lambda.zip"
179
+ temp_zip_name="/tmp/$(basename "$module_dir").zip"
180
+
181
+ echo "Processing directory $lambda_dir"
182
+ echo "Target zip file: $zip_name"
183
+
184
+ # Create a temporary zip file in /tmp directory
185
+ cd "$lambda_dir"
186
+ zip -r "$temp_zip_name" ./*
187
+ cd - > /dev/null
188
+
189
+ # Move the temporary zip file to the desired location
190
+ mv "$temp_zip_name" "$zip_name"
191
+
192
+ echo "Zipped contents of $lambda_dir to $zip_name"
193
+ done
194
+
195
+ # Verify contents of each module directory after zipping
196
+ find .terraform/modules -mindepth 1 -maxdepth 1 -type d | while read dir; do
197
+ echo "Contents of $dir:"
198
+ ls -l "$dir"
199
+ done
200
+
201
+ - name : Verify Lambda ZIPs Contents
202
+ run : |
203
+ cd ${{ inputs.stack }}
204
+ for zip in $(find .terraform/modules -type f -name 'lambda.zip'); do
205
+ echo "Checking contents of $zip:"
206
+ unzip -l "$zip"
207
+ done
208
+
209
+ - name : Verify Lambda ZIPs
210
+ run : |
211
+ find ${{ inputs.stack }}/.terraform/modules -type f -name 'lambda.zip' -exec ls -l {} \;
212
+
172
213
- name : Tofu Apply
173
214
id : apply
174
215
continue-on-error : true
@@ -251,6 +292,12 @@ jobs:
251
292
-H "Content-Type: application/json" \
252
293
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
253
294
-d @comment3.txt
295
+
296
+ # Cleanup lambda.zip files
297
+ # - name: Cleanup lambda.zip Files
298
+ # run: |
299
+ # find . -type f -name 'lambda.zip' -delete
300
+
254
301
255
302
logging :
256
303
name : ' Save logs'
@@ -282,4 +329,4 @@ jobs:
282
329
# Upload it to s3
283
330
aws s3 cp $LOG_FILENAME s3://${{ inputs.s3bucketName }}/logs/Apply/
284
331
env :
285
- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
332
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments