Skip to content
This repository was archived by the owner on Jul 20, 2024. It is now read-only.

Commit 1251aa4

Browse files
author
Pete Dunlap
committed
updates to readme
1 parent 2991eae commit 1251aa4

File tree

1 file changed

+39
-20
lines changed

1 file changed

+39
-20
lines changed

README.md

Lines changed: 39 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,54 @@
11
# action-lambda-python-zip
2-
GitHub Action to make zip deployment to AWS Lambda with requirements in a separate layer.
32

4-
[![GitHubActions](https://img.shields.io/badge/listed%20on-GitHubActions-blue.svg)](https://github.com/marketplace/actions/aws-lambda-zip-deploy-python)
3+
GitHub Action to make zip deployment to AWS Lambda with pip requirements in a separate layer and additional custom layers.
4+
5+
Forked from: [![GitHubActions](https://img.shields.io/badge/listed%20on-GitHubActions-blue.svg)](https://github.com/marketplace/actions/aws-lambda-zip-deploy-python)
56

67
## Description
78
This action automatically installs requirements, zips and deploys the code including the dependencies as a separate layer.
89

9-
#### Python 3.8 is supported
10+
#### Python 3.7 is supported
1011

1112
### Pre-requisites
1213
In order for the Action to have access to the code, you must use the `actions/checkout@master` job before it.
1314

14-
### Structure
15-
- Lambda code should be `lambda_function.py`** unless you want to have a customized file name.
16-
- **Dependencies must be stored in a `requirements.txt`**
15+
### File Structure
16+
This example workflow assumes your `requirements.txt` is in the root directory and that your functions are in folders with their function name as the directory name. Custom layers are assumed to be in a directory that matches their `custom_layer_N_path` value.
17+
18+
The below workflow would publish code to layers (pip and any custom layers) and functions (first_function and second_function), and finally also attach the layers to those updated functions.
19+
1720

1821
### Environment variables
19-
Storing credentials as secret is stronly recommended.
22+
Storing credentials as a Github secret is strongly recommended.
2023

2124
- **AWS Credentials**
22-
`AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, `REGION` are required.
25+
`AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` are required.
2326

2427
### Inputs
25-
- `lambda_region`
26-
- `lambda_layer_arn`
27-
The ARN for the Lambda layer the dependencies should be pushed to **without the version** (version will be automatically updated on AWS).
28-
- `lambda_function_name`
29-
The Lambda function name. [From the AWS docs](https://docs.aws.amazon.com/cli/latest/reference/lambda/update-function-code.html), it can be any of the following:
30-
- Function name - `function-name`
31-
- Function ARN - `arn:aws:lambda:us-west-2:123456789012:function:function-name`
32-
- Partial ARN - `123456789012:function:function-name`
3328
- `requirements_txt`
3429
The name/path for the `requirements.txt` file. Defaults to `requirements.txt`.
30+
- `pip_layer_arn`
31+
The ARN for the Lambda layer the dependencies should be pushed to **without the version** (version will be automatically updated on AWS).
32+
- `custom_layer_1_path`
33+
Something like a folder of `utils` which holds all your utility code.
34+
- `custom_layer_1_arn`
35+
The ARN for the Lambda layer where this utility code will go.
36+
- `custom_layer_2_path`
37+
Same as above if you need more layers.
38+
- `custom_layer_2_arn`
39+
Same as above if you need more layers.
40+
- `custom_layer_3_path`
41+
Same as above if you need more layers.
42+
- `custom_layer_3_arn`
43+
Same as above if you need more layers.
44+
- `custom_layer_4_path`
45+
Same as above if you need more layers.
46+
- `custom_layer_4_arn`
47+
Same as above if you need more layers.
48+
- `lambda_function_names`
49+
The Lambda function names comma separated.
50+
- `aws_region`
51+
3552

3653
### Example Workflow
3754
```yaml
@@ -46,11 +63,13 @@ jobs:
4663
steps:
4764
- uses: actions/checkout@master
4865
- name: Deploy code to Lambda
49-
uses: seattleagainstslavery/action-lambda-python-zip@v1.0
66+
uses: seattleagainstslavery/action-lambda-python-zip@v1.1
5067
with:
51-
lambda_layer_arn: 'arn:aws:lambda:eu-central-1:222222222222:layer:layer-name'
52-
lambda_function_name: ${{ secrets.LAMBDA_FUNCTION_NAME }}
53-
lambda_region: 'eu-central-1'
68+
pip_layer_arn: 'YOUR_UNIQUE_ARN:layer:LAYER_NAME'
69+
custom_layer_1_path: 'utils'
70+
custom_layer_1_arn: 'YOUR_UNIQUE_ARN:layer:LAYER_NAME'
71+
lambda_function_names: 'first_function,second_function'
72+
aws_region: 'us-east-2'
5473
env:
5574
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
5675
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

0 commit comments

Comments
 (0)