Skip to content

Update to use DynamoDB #8

Update to use DynamoDB

Update to use DynamoDB #8

name: Deploy to AWS Lambda
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Log in to Amazon ECR
id: login-ecr
uses: jwalton/gh-ecr-login@v1
with:
region: ${{ secrets.AWS_REGION }}
access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- name: Run Tests
id: run-tests
run: |
pip3 install --no-cache-dir -r requirements.txt
pip3 install --no-cache-dir -r requirements-dev.txt
pytest .
- name: Build, tag, and push Docker image
id: build-image
run: |
ECR_REGISTRY=${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.${{ secrets.AWS_REGION }}.amazonaws.com
ECR_REPOSITORY=${ECR_REGISTRY}/${IMAGE_NAME}
docker build -t ${IMAGE_NAME} .
docker tag ${IMAGE_NAME}:latest ${ECR_REPOSITORY}:latest
docker push ${ECR_REPOSITORY}:latest
env:
IMAGE_NAME: uv-warning-bot-lambda
- name: Update Lambda function
run: |
aws lambda update-function-code --function-name uv-warning-bot-lambda --image-uri ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.${{ secrets.AWS_REGION }}.amazonaws.com/uv-warning-bot-lambda:latest
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ secrets.AWS_REGION }}