Skip to content

Commit

Permalink
add architectures and runtimes parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
Hervé Lee committed Nov 22, 2021
1 parent ccfd358 commit dc56017
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
9 changes: 9 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ inputs:
description: Path to the code.
required: false
default: './'
architectures:
description: Target architectures
required: false
default: 'x86_64'
runtimes:
description: Compatible runtimes in space-separated string
required: true
runs:
using: 'docker'
image: 'Dockerfile'
Expand All @@ -28,6 +35,8 @@ runs:
- ${{ inputs.lambda_function_name }}
- ${{ inputs.code_path }}
- ${{ inputs.s3_bucket }}
- ${{ inputs.architectures }}
- ${{ inputs.runtimes }}
branding:
icon: 'layers'
color: 'yellow'
6 changes: 3 additions & 3 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ install_zip_dependencies(){

publish_dependencies_as_layer(){
echo "Publishing dependencies as a layer..."
local result=$(aws lambda publish-layer-version --layer-name "${INPUT_LAMBDA_LAYER_ARN}" --zip-file fileb://dependencies.zip)
local result=$(aws lambda publish-layer-version --layer-name "${INPUT_LAMBDA_LAYER_ARN}" --compatible-runtimes ${INPUT_RUNTIMES} --compatible-architectures ${INPUT_ARCHITECTURES} --zip-file fileb://dependencies.zip)
LAYER_VERSION=$(jq '.Version' <<< "$result")
rm -rf python
rm dependencies.zip
Expand All @@ -22,12 +22,12 @@ 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
aws lambda update-function-code --architectures ${INPUT_ARCHITECTURES} --function-name "${INPUT_LAMBDA_FUNCTION_NAME}" --zip-file fileb://code.zip
}

update_function_layers(){
echo "Using the layer in the function..."
aws lambda update-function-configuration --function-name "${INPUT_LAMBDA_FUNCTION_NAME}" --layers "${INPUT_LAMBDA_LAYER_ARN}:${LAYER_VERSION}"
aws lambda update-function-configuration --function-name "${INPUT_LAMBDA_FUNCTION_NAME}" --runtime "${INPUT_RUNTIMES%% *}" --layers "${INPUT_LAMBDA_LAYER_ARN}:${LAYER_VERSION}"
}

deploy_lambda_function(){
Expand Down

0 comments on commit dc56017

Please sign in to comment.