feat(ci): auto deploy backend service to aws ecs with load balancer #27
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy to AWS Amplify | |
on: | |
push: | |
branches: | |
- main | |
# Trigger deployment when a PR is merged into main | |
pull_request: | |
branches: | |
- main | |
paths: | |
- "frontend/**" | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
# Step 1: Checkout the repository | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
# Step 2: Install AWS CLI | |
- name: Install AWS CLI | |
run: | | |
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" | |
unzip awscliv2.zip | |
sudo ./aws/install --update | |
# Step 3: Configure AWS credentials | |
- 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: us-east-2 | |
# Step 4: Deploy to AWS Amplify | |
- name: Trigger AWS Amplify deployment | |
run: | | |
aws amplify start-job \ | |
--app-id ${{ secrets.AWS_AMPLIFY_APP_ID }} \ | |
--branch-name main \ | |
--job-type RELEASE |