Skip to content
This repository has been archived by the owner on Sep 17, 2024. It is now read-only.

Archive project

Archive project #319

Workflow file for this run

# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Python application
on:
push:
branches:
- master
- main
permissions:
id-token: write
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: 3.12
cache: 'pip'
- name: Install dependencies
run: |
if [ -f requirements.txt ]; then pip install --target ./package -r requirements.txt; fi
- name: Create ZIP
run: |
(cd package;zip -r update-zestimate.zip ./*)
zip -gj package/update-zestimate.zip functions/update-zestimate/main.py
mv package/update-zestimate.zip .
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
role-session-name: ${{ secrets.AWS_SESSION_NAME }}
aws-region: us-west-2
- name: Copy deployment ZIP to AWS
run: |
aws s3 cp update-zestimate.zip s3://${{ secrets.DEPLOY_BUCKET }}/${{ secrets.DEPLOY_PATH }}
- name: Update Lambda
run: |
aws lambda update-function-code --function-name ${{ secrets.LAMBDA_FUNCTION_NAME }} --s3-bucket ${{ secrets.DEPLOY_BUCKET}} --s3-key ${{ secrets.DEPLOY_PATH }} > /dev/null