@@ -57,25 +57,66 @@ jobs:
5757 path : ./reports/pytest.xml
5858 if-no-files-found : warn
5959
60- build :
61- name : Build Docker Image
62- uses : lambda-feedback/chat-function-workflows/.github/workflows/gh_build.yml@main
63- needs : test
64- permissions :
65- contents : read
66- id-token : write
67- packages : write
68-
6960 deploy :
70- name : Deploy to Lambda Feedback
71- uses : lambda-feedback/chat-function-workflows/.github/workflows/dev_deploy.yml@main
61+ name : Deploy to AWS Lambda
62+ runs-on : ubuntu-latest
7263 needs : test
73- with :
74- template-repository-name : " lambda-feedback/chat-function-boilerplate"
75- permissions :
76- contents : read
77- id-token : write
78- packages : write
79- secrets :
80- aws-access-key-id : ${{ secrets.LAMBDA_CONTAINER_PIPELINE_AWS_ID }}
81- aws-secret-key : ${{ secrets.LAMBDA_CONTAINER_PIPELINE_AWS_SECRET}}
64+ steps :
65+ - name : Checkout Code
66+ uses : actions/checkout@v4
67+
68+ - name : Configure AWS Credentials
69+ uses : aws-actions/configure-aws-credentials@v4
70+ with :
71+ # Created the Secrets Under the Repo only with These Variables
72+ aws-access-key-id : ${{ secrets.LAMBDA_CONTAINER_PIPELINE_AWS_ID }}
73+ aws-secret-access-key : ${{ secrets.LAMBDA_CONTAINER_PIPELINE_AWS_SECRET }}
74+ aws-region : eu-west-2
75+
76+ - name : Login to Amazon ECR
77+ id : login-pf-aws-ecr
78+ uses : aws-actions/amazon-ecr-login@v2
79+
80+ - name : Build and push the tagged docker image to Amazon ECR
81+ id : build-custom-image
82+ env :
83+ ECR_REGISTRY : ${{ steps.login-pf-aws-ecr.outputs.registry }}
84+ ECR_REPOSITORY : lambda-feedback-dev-chat
85+ IMAGE_TAG : latest
86+ run : |
87+ docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
88+ docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
89+
90+ - name : Update aws custom lambda function code
91+ env :
92+ ECR_REGISTRY : ${{ steps.login-pf-aws-ecr.outputs.registry }}
93+ ECR_REPOSITORY : lambda-feedback-dev-chat
94+ IMAGE_TAG : latest
95+ FUNCTION_NAME : lambda-feedback-dev-chat
96+ run : |
97+ aws lambda update-function-code \
98+ --function-name $FUNCTION_NAME \
99+ --image-uri $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
100+
101+ # build:
102+ # name: Build Docker Image
103+ # uses: lambda-feedback/chat-function-workflows/.github/workflows/gh_build.yml@main
104+ # needs: test
105+ # permissions:
106+ # contents: read
107+ # id-token: write
108+ # packages: write
109+
110+ # deploy:
111+ # name: Deploy to Lambda Feedback
112+ # uses: lambda-feedback/chat-function-workflows/.github/workflows/dev_deploy.yml@main
113+ # needs: test
114+ # with:
115+ # template-repository-name: "lambda-feedback/chat-function-boilerplate"
116+ # permissions:
117+ # contents: read
118+ # id-token: write
119+ # packages: write
120+ # secrets:
121+ # aws-access-key-id: ${{ secrets.LAMBDA_CONTAINER_PIPELINE_AWS_ID }}
122+ # aws-secret-key: ${{ secrets.LAMBDA_CONTAINER_PIPELINE_AWS_SECRET}}
0 commit comments