Skip to content

Commit 14b25e4

Browse files
authored
adding deploy action
1 parent 7f204b1 commit 14b25e4

File tree

3 files changed

+41
-4
lines changed

3 files changed

+41
-4
lines changed

.github/workflows/deploy.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Deploy to AWS Lambda
2+
3+
on:
4+
release:
5+
types: [released]
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
deploy:
12+
13+
runs-on: ubuntu-latest
14+
environment: production
15+
16+
steps:
17+
- uses: actions/checkout@v3
18+
- name: Set up Python 3.9
19+
uses: actions/setup-python@v3
20+
with:
21+
python-version: "3.9"
22+
- name: Create zip package
23+
run: |
24+
pip install --target ./build -r ./hotasballs/requirements.txt
25+
cd build && zip -r ../lambda.zip .
26+
cd ../hotasballs && zip -g ../lambda.zip service.py
27+
- name: Deploy to AWS
28+
uses: appleboy/lambda-action@master
29+
with:
30+
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
31+
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
32+
aws_region: ${{ secrets.AWS_REGION }}
33+
function_name: hotasballs
34+
zip_file: lambda.zip
35+
runtime: python3.9
36+
handler: service.handler
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This workflow will install Python dependencies, run tests and lint with a single version of Python
22
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
33

4-
name: Build and Test
4+
name: Tests and Lint
55

66
on:
77
push:
@@ -13,16 +13,16 @@ permissions:
1313
contents: read
1414

1515
jobs:
16-
build:
16+
test:
1717

1818
runs-on: ubuntu-latest
1919

2020
steps:
2121
- uses: actions/checkout@v3
22-
- name: Set up Python 3.10
22+
- name: Set up Python 3.9
2323
uses: actions/setup-python@v3
2424
with:
25-
python-version: "3.10"
25+
python-version: "3.9"
2626
- name: Install dependencies
2727
run: |
2828
python -m pip install --upgrade pip

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ wheels/
2424
.installed.cfg
2525
*.egg
2626
MANIFEST
27+
lambda.zip
2728

2829
# PyInstaller
2930
# Usually these files are written by a python script from a template

0 commit comments

Comments
 (0)