74 lines
2.0 KiB
YAML
74 lines
2.0 KiB
YAML
name: CD Pipeline
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
deploy-staging:
|
|
name: Deploy to Staging
|
|
runs-on: ubuntu-latest
|
|
environment: staging
|
|
env:
|
|
KUBECONFIG: ${{ github.workspace }}/kubeconfig
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Setup kubectl
|
|
uses: azure/setup-kubectl@v3
|
|
|
|
- name: Setup Helm
|
|
uses: azure/setup-helm@v3
|
|
|
|
- name: Configure kubectl
|
|
run: |
|
|
echo "${{ secrets.KUBECONFIG_STAGING }}" | base64 -d > "$KUBECONFIG"
|
|
|
|
- name: Deploy to Kubernetes
|
|
run: |
|
|
kubectl apply -f gitops/apps/api/
|
|
kubectl apply -f gitops/apps/frontend/
|
|
kubectl apply -f gitops/apps/portal/
|
|
|
|
- name: Wait for deployment
|
|
run: |
|
|
kubectl rollout status deployment/api -n sankofa
|
|
kubectl rollout status deployment/frontend -n sankofa
|
|
kubectl rollout status deployment/portal -n sankofa
|
|
|
|
deploy-production:
|
|
name: Deploy to Production
|
|
runs-on: ubuntu-latest
|
|
environment: production
|
|
needs: [deploy-staging]
|
|
if: github.ref == 'refs/heads/main'
|
|
env:
|
|
KUBECONFIG: ${{ github.workspace }}/kubeconfig
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Setup kubectl
|
|
uses: azure/setup-kubectl@v3
|
|
|
|
- name: Configure kubectl
|
|
run: |
|
|
echo "${{ secrets.KUBECONFIG_PRODUCTION }}" | base64 -d > "$KUBECONFIG"
|
|
|
|
- name: Deploy to Kubernetes
|
|
run: |
|
|
kubectl apply -f gitops/apps/api/
|
|
kubectl apply -f gitops/apps/frontend/
|
|
kubectl apply -f gitops/apps/portal/
|
|
|
|
- name: Wait for deployment
|
|
run: |
|
|
kubectl rollout status deployment/api -n sankofa
|
|
kubectl rollout status deployment/frontend -n sankofa
|
|
kubectl rollout status deployment/portal -n sankofa
|
|
|
|
- name: Run smoke tests
|
|
run: |
|
|
# Smoke tests would go here
|
|
echo "Running smoke tests..."
|