diff --git a/.github/workflows/deploy_fastapi_backend.yml b/.github/workflows/deploy_fastapi_backend.yml index 24fe7fd7..c246c47b 100644 --- a/.github/workflows/deploy_fastapi_backend.yml +++ b/.github/workflows/deploy_fastapi_backend.yml @@ -91,6 +91,7 @@ jobs: DB_PORT: ${{ steps.set_db_credentials.outputs.db_port }} DB_NAME: ${{ steps.set_db_credentials.outputs.db_name }} ECR_URI: ${{ steps.set_ecr_credentials.outputs.ecr_uri }} + GITHUB_SHA: ${{ github.sha }} run: | # Fetch database credentials from AWS Secrets Manager SECRET_VALUE=$(aws secretsmanager get-secret-value --secret-id ${{ github.ref_name }}/assessment_model/db_credentials --query SecretString) diff --git a/serverless.yml b/serverless.yml index f15924f8..89eb666a 100644 --- a/serverless.yml +++ b/serverless.yml @@ -17,6 +17,7 @@ provider: DB_PASSWORD: ${env:DB_PASSWORD} DB_PORT: ${env:DB_PORT} ECR_URI: ${env:ECR_URI} + GITHUB_SHA: ${env:GITHUB_SHA} # Give lambda access to read from the bucket iam: role: @@ -43,7 +44,7 @@ custom: functions: app: image: - uri: ${env:ECR_URI}:latest + uri: ${env:ECR_URI}:${env:GITHUB_SHA} events: - http: path: /{proxy+}