Skip to content

Commit ad3c71c

Browse files
committed
fix: Add AWS credentials check and deployment readiness validation
- Skip deployment job if AWS credentials are not configured - Add deployment-check job with helpful instructions for setup - Prevent AWS credentials error and provide clear guidance - Tests and security scans will still run successfully - Deployment activates automatically once secrets are configured Setup instructions: 1. Go to GitHub repo settings/secrets/actions 2. Add AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, API_KEY 3. Create ECR repository: neurobank-fastapi
1 parent dd89acc commit ad3c71c

File tree

1 file changed

+40
-1
lines changed

1 file changed

+40
-1
lines changed

.github/workflows/ci-cd.yml

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,54 @@ jobs:
7474
bandit-report.json
7575
safety-report.json
7676
77-
build-and-deploy:
77+
deployment-check:
7878
needs: [test, security]
7979
runs-on: ubuntu-latest
8080
if: github.ref == 'refs/heads/main'
8181

82+
steps:
83+
- name: Check deployment readiness
84+
run: |
85+
echo "🔍 Checking deployment readiness..."
86+
if [ -z "${{ secrets.AWS_ACCESS_KEY_ID }}" ] || [ -z "${{ secrets.AWS_SECRET_ACCESS_KEY }}" ]; then
87+
echo ""
88+
echo "⚠️ AWS CREDENTIALS NOT CONFIGURED"
89+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
90+
echo "To enable automatic deployment, please configure:"
91+
echo ""
92+
echo "1. Go to: https://github.com/${{ github.repository }}/settings/secrets/actions"
93+
echo "2. Add these Repository Secrets:"
94+
echo " • AWS_ACCESS_KEY_ID"
95+
echo " • AWS_SECRET_ACCESS_KEY"
96+
echo " • API_KEY (for your application)"
97+
echo ""
98+
echo "3. Also create an ECR repository named: ${{ env.ECR_REPOSITORY }}"
99+
echo ""
100+
echo "✅ Tests and Security scans completed successfully!"
101+
echo "🚀 Deployment will run automatically once credentials are configured"
102+
echo ""
103+
else
104+
echo "✅ AWS credentials are configured - deployment will proceed"
105+
fi
106+
107+
build-and-deploy:
108+
needs: [test, security]
109+
runs-on: ubuntu-latest
110+
if: github.ref == 'refs/heads/main' && secrets.AWS_ACCESS_KEY_ID != ''
111+
82112
steps:
83113
- name: Checkout
84114
uses: actions/checkout@v4
85115

116+
- name: Check AWS credentials
117+
run: |
118+
if [ -z "${{ secrets.AWS_ACCESS_KEY_ID }}" ] || [ -z "${{ secrets.AWS_SECRET_ACCESS_KEY }}" ]; then
119+
echo "❌ AWS credentials not configured. Please set AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY secrets."
120+
echo "💡 Go to: https://github.com/${{ github.repository }}/settings/secrets/actions"
121+
exit 1
122+
fi
123+
echo "✅ AWS credentials are configured"
124+
86125
- name: Set up Python
87126
uses: actions/setup-python@v5
88127
with:

0 commit comments

Comments
 (0)