Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
nikitamalinov committed Feb 21, 2024
1 parent 6d6fce6 commit 8698c48
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 42 deletions.
Empty file added .github/hiroshi.yml
Empty file.
82 changes: 41 additions & 41 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,46 +1,46 @@
name: Build and Push Docker Image
# name: Build and Push Docker Image

on:
push:
branches:
- nikita
# on:
# push:
# branches:
# - main

jobs:
deploy_lambda:
name: Publish and Deploy
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
# jobs:
# deploy_lambda:
# name: Publish and Deploy
# runs-on: ubuntu-latest
# steps:
# - name: Checkout code
# uses: actions/checkout@v2

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: AKIA5ZOUUDPV4JSVHC5U
aws-secret-access-key: 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
aws-region: us-west-1
# - name: Configure AWS Credentials
# uses: aws-actions/configure-aws-credentials@v1
# with:
# aws-access-key-id: AKIA5ZOUUDPV4JSVHC5U
# aws-secret-access-key: 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
# aws-region: us-west-1

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
# - name: Login to Amazon ECR
# id: login-ecr
# uses: aws-actions/amazon-ecr-login@v1

- name: Build, tag, and push image to Amazon ECR
id: build-image
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: fastapi-demo
IMAGE_TAG: fastapi-demo
run: |
docker build -f ./Dockerfile -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
- name: Update Lambda function with latest ECR image
env:
LAMBDA_NAME: lambda-container
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: fastapi-demo
IMAGE_TAG: latest
run: |
aws lambda update-function-code \
--function-name $LAMBDA_NAME \
--image-uri $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
# - name: Build, tag, and push image to Amazon ECR
# id: build-image
# env:
# ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
# ECR_REPOSITORY: fastapi-demo
# IMAGE_TAG: fastapi-demo
# run: |
# docker build -f ./Dockerfile -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
# docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG

# - name: Update Lambda function with latest ECR image
# env:
# LAMBDA_NAME: lambda-container
# ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
# ECR_REPOSITORY: fastapi-demo
# IMAGE_TAG: latest
# run: |
# aws lambda update-function-code \
# --function-name $LAMBDA_NAME \
# --image-uri $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
46 changes: 46 additions & 0 deletions .github/workflows/nikita.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Build and Push Docker Image

on:
push:
branches:
- nikita

jobs:
deploy_lambda:
name: Publish and Deploy
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: AKIA5ZOUUDPV4JSVHC5U
aws-secret-access-key: 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
aws-region: us-west-1

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1

- name: Build, tag, and push image to Amazon ECR
id: build-image
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: fastapi-demo
IMAGE_TAG: fastapi-demo
run: |
docker build -f ./Dockerfile -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
- name: Update Lambda function with latest ECR image
env:
LAMBDA_NAME: lambda-container
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: fastapi-demo
IMAGE_TAG: latest
run: |
aws lambda update-function-code \
--function-name $LAMBDA_NAME \
--image-uri $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
2 changes: 1 addition & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ async def handle_webhook(request: Request) -> dict[str, str]:
try:
print("Webhook received")
# Validate the webhook signature
await github_manager.verify_webhook_signature(request=request, secret=GITHUB_WEBHOOK_SECRET)
# await github_manager.verify_webhook_signature(request=request, secret=GITHUB_WEBHOOK_SECRET)
print("Webhook signature verified")

# Process the webhook event
Expand Down

0 comments on commit 8698c48

Please sign in to comment.