Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add zip file path option #23

Merged
merged 5 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ Provision AWS Lambda, as well as IAM Role, CloudFront, Route53 RecordSet, and mo
| s3-key | S3 Key of the deployment packag | | |
| s3-object-version | For versioned objects, the version of the deployment package object to use. | | |
| zip-file | The source code of your Lambda function. | | |
| zip-file-path | The ZipFile Relative Path of your Lambda function. | | |
| role-policy | Lambda ExecutionRole Policy | | |
| architecture | Architecture for the Lambda function (x86_64 or arm64) | | x86_64 |
| memory-size | Memory size for the Lambda function (in MB) | | 1024 |
Expand Down
15 changes: 14 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ inputs:
description: S3 ObjectVersion For Deployment Package
required: false
zip-file:
description: ZipFile For Deployment Package
description: source code For Deployment Package
required: false
zip-file-path:
description: ZipFile Path For Deployment Package
required: false
runtime:
description: The identifier of the function's runtime. Runtime is required if the deployment package is a .zip file archive.
Expand Down Expand Up @@ -98,6 +101,12 @@ runs:
echo "stack_name=$STACK_NAME" >> "$GITHUB_OUTPUT"
echo "path=$GITHUB_ACTION_PATH" >> "$GITHUB_OUTPUT"

if [ -n "${{ inputs.zip-file-path }}" ]; then
echo "zip_file_path=${{ github.workspace }}/${{ inputs.zip-file-path }}" >> "$GITHUB_OUTPUT"
else
echo "zip_file_path=" >> "$GITHUB_OUTPUT"
fi

- uses: actions/setup-node@main
with:
node-version: "20"
Expand All @@ -114,6 +123,7 @@ runs:
LAMBDA_S3_KEY: ${{ inputs.s3-key }}
LAMBDA_S3_OBJECT_VERSION: ${{ inputs.s3-object-version }}
LAMBDA_ZIP_FILE: ${{ inputs.zip-file }}
LAMBDA_ZIP_FILE_PATH: ${{ steps.env.outputs.zip_file_path }}
LAMBDA_ARCHITECTURE: ${{ inputs.architecture }}
LAMBDA_MEMORY_SIZE: ${{ inputs.memory-size }}
LAMBDA_STORAGE_SIZE: ${{ inputs.ephemeral-storage-size }}
Expand All @@ -127,6 +137,9 @@ runs:
RUNTIME: ${{ inputs.runtime }}
HANDLER: ${{ inputs.handler }}

- shell: bash
run: aws cloudformation validate-template --template-body file://${{ steps.env.outputs.path }}/template.json

- id: lambda
uses: aws-actions/aws-cloudformation-github-deploy@master
with:
Expand Down
2 changes: 1 addition & 1 deletion index.js

Large diffs are not rendered by default.