Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix: update branding to llms.txt and fix status reset issue #9

fix: update branding to llms.txt and fix status reset issue

fix: update branding to llms.txt and fix status reset issue #9

Workflow file for this run

name: Deploy to AWS App Runner
on:
push:
branches: [main]
workflow_dispatch:
env:
AWS_REGION: us-east-1
ECR_REPOSITORY: llm-txt-api
APP_RUNNER_SERVICE_ARN: arn:aws:apprunner:us-east-1:796973517930:service/llm-txt-api/065754d32c444052ae509f0f972e7bf0
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Check for AWS credentials
run: |
if [ -z "${{ secrets.AWS_ACCESS_KEY_ID }}" ]; then
echo "❌ AWS_ACCESS_KEY_ID secret is not set"
echo "Please add it at: https://github.com/${{ github.repository }}/settings/secrets/actions"
exit 1
fi
if [ -z "${{ secrets.AWS_SECRET_ACCESS_KEY }}" ]; then
echo "❌ AWS_SECRET_ACCESS_KEY secret is not set"
echo "Please add it at: https://github.com/${{ github.repository }}/settings/secrets/actions"
exit 1
fi
echo "✅ AWS credentials are configured"
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
with:
mask-password: true
- name: Build, tag, and push Docker image to Amazon ECR
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
IMAGE_TAG: ${{ github.sha }}
run: |
docker build -f Dockerfile.api -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
docker tag $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG $ECR_REGISTRY/$ECR_REPOSITORY:latest
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
docker push $ECR_REGISTRY/$ECR_REPOSITORY:latest
- name: Update App Runner service
run: |
aws apprunner start-deployment \
--service-arn ${{ env.APP_RUNNER_SERVICE_ARN }} \
--region ${{ env.AWS_REGION }}
echo "Deployment started. Waiting for completion..."
# Wait for deployment to complete (max 10 minutes)
for i in {1..40}; do
STATUS=$(aws apprunner describe-service \
--service-arn ${{ env.APP_RUNNER_SERVICE_ARN }} \
--region ${{ env.AWS_REGION }} \
--query 'Service.Status' \
--output text)
echo "Service status: $STATUS"
if [ "$STATUS" = "RUNNING" ]; then
echo "Deployment completed successfully!"
exit 0
elif [ "$STATUS" = "OPERATION_IN_PROGRESS" ]; then
echo "Deployment in progress..."
sleep 15
else
echo "Unexpected status: $STATUS"
exit 1
fi
done
echo "Deployment timed out"
exit 1