Skip to content

Commit 76c6dc1

Browse files
committed
Enhance deployment workflow by adding concurrency control to prevent simultaneous deployments and implementing cleanup steps for failed deployments, ensuring a more robust and manageable CI/CD process.
1 parent b90319f commit 76c6dc1

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

.github/workflows/deploy.yml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ on:
55
branches: [main]
66
workflow_dispatch: # Allow manual trigger
77

8+
# Prevent multiple deployments from running simultaneously
9+
concurrency:
10+
group: deploy-${{ github.ref }}
11+
cancel-in-progress: false # Don't cancel running deployments, just queue them
12+
813
env:
914
AWS_REGION: us-east-1
1015
PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }}
@@ -31,9 +36,10 @@ jobs:
3136
# Login to ECR (needed for Docker push)
3237
- name: Login to Amazon ECR
3338
id: login-ecr
34-
uses: aws-actions/amazon-ecr-login@v2
39+
uses:
40+
aws-actions/amazon-ecr-login@v2
3541

36-
# Deploy everything through Pulumi (handles Docker building and infrastructure)
42+
# Deploy everything through Pulumi (handles Docker building and infrastructure)
3743
- name: Deploy with Pulumi
3844
run: |
3945
cd apps/infra
@@ -96,6 +102,15 @@ jobs:
96102
97103
echo "✅ Migrations completed successfully!"
98104
105+
# Cleanup on failure
106+
- name: Cleanup on failure
107+
if: failure()
108+
run: |
109+
echo "🧹 Cleaning up failed deployment..."
110+
cd apps/infra
111+
pulumi cancel --yes || true
112+
echo "Cleanup completed"
113+
99114
- name: Deployment complete
100115
run: |
101116
echo "✅ Deployment completed successfully!"

0 commit comments

Comments
 (0)