From ccfd35888a9d0abdcfbf1a9ced3df8f4383f9608 Mon Sep 17 00:00:00 2001 From: Cyril Feraudet Date: Mon, 22 Nov 2021 14:26:58 +0100 Subject: [PATCH] Use s3 bucket to store lambda code --- .gitignore | 1 + action.yml | 4 ++++ entrypoint.sh | 1 + 3 files changed, 6 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1ee84da --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.sw* diff --git a/action.yml b/action.yml index 58e08bb..b536bfe 100644 --- a/action.yml +++ b/action.yml @@ -12,6 +12,9 @@ inputs: lambda_function_name: description: The Lambda function name. Check the AWS docs/readme for examples. required: true + s3_bucket: + description: S3 bucket where upload lambda zip code. + required: true code_path: description: Path to the code. required: false @@ -24,6 +27,7 @@ runs: - ${{ inputs.lambda_layer_arn }} - ${{ inputs.lambda_function_name }} - ${{ inputs.code_path }} + - ${{ inputs.s3_bucket }} branding: icon: 'layers' color: 'yellow' diff --git a/entrypoint.sh b/entrypoint.sh index f11f46e..f63382e 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -21,6 +21,7 @@ publish_dependencies_as_layer(){ publish_function_code(){ echo "Deploying the code itself..." zip -r code.zip . -x \*.git\* + aws s3 cp code.zip s3://${INPUT_S3_BUCKET}/${INPUT_LAMBDA_FUNCTION_NAME}.zip aws lambda update-function-code --function-name "${INPUT_LAMBDA_FUNCTION_NAME}" --zip-file fileb://code.zip }