Files
thamanyah/.gitea/workflows/cms-deploy.yml
T
FahdShalhoub be5a78a923
Build, Push and Deploy CMS / build-push-deploy (push) Failing after 1m47s
FIX: Added Missing Env Variables
2026-08-16 19:32:36 +03:00

58 lines
1.8 KiB
YAML

name: Build, Push and Deploy CMS
on:
push:
branches: [main]
paths:
- "cms/**"
- ".gitea/workflows/cms-deploy.yml"
env:
AWS_REGION: us-east-1
ECR_REPOSITORY: cms
ECS_CLUSTER_ARN: arn:aws:ecs:us-east-1:887083795404:cluster/app-cluster-384acc4
CMS_ECS_SERVICE_ARN: arn:aws:ecs:us-east-1:887083795404:service/app-cluster-384acc4/cms-service-350b51b
jobs:
build-push-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
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: Log in to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push image
uses: docker/build-push-action@v6
with:
context: ./cms
file: ./cms/Dockerfile
push: true
tags: |
${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_REPOSITORY }}:latest
${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_REPOSITORY }}:${{ gitea.sha }}
# cluster/service ARNs come from `pulumi stack output ecsClusterArn` /
# `cmsServiceArn` in the infrastructure project — set once as repo
# variables (Settings > Actions > Variables), not secrets, since ARNs
# aren't sensitive.
- name: Deploy to ECS
run: |
aws ecs update-service \
--cluster "${{ env.ECS_CLUSTER_ARN }}" \
--service "${{ env.CMS_ECS_SERVICE_ARN }}" \
--force-new-deployment \
--region "${{ env.AWS_REGION }}"