Day 5 sets up GitHub Actions to automatically rebuild and redeploy your app whenever you push code. One push, one deployment — no manual steps.
CI/CD (Continuous Integration/Continuous Deployment) means: every push to main automatically tests your code, builds a new Docker image, and deploys it. Here is the GitHub Actions workflow:
name: Build and Deploy
on:
push:
branches: [main]
env:
AWS_REGION: us-east-1
ECR_REPOSITORY: my-ai-app
APP_RUNNER_SERVICE: my-ai-app-service
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
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
- name: Build, tag, and push image
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
IMAGE_TAG: ${{ github.sha }}
run: |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
echo "image=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" >> $GITHUB_OUTPUT
- name: Deploy to App Runner
uses: awslabs/amazon-app-runner-deploy@main
with:
service: ${{ env.APP_RUNNER_SERVICE }}
image: ${{ steps.build.outputs.image }}
region: ${{ env.AWS_REGION }}
wait-for-service-stability-seconds: 180# In your GitHub repo:
# Settings → Secrets and variables → Actions → New secret
# Add these two secrets:
# AWS_ACCESS_KEY_ID = your AWS access key
# AWS_SECRET_ACCESS_KEY = your AWS secret key
# Then push to main and watch the Actions tabOur in-person AI bootcamp covers advanced AI development, agentic systems, and production deployment. Five cities. $1,490.
Reserve Your Seat →