proto: regenerate syscall protobufs with canonical TPM types; add cam… #28
This file contains hidden or 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: Deployment | ||
| on: | ||
| push: | ||
| branches: [ main ] | ||
| tags: [ 'v*' ] | ||
| workflow_dispatch: | ||
| inputs: | ||
| environment: | ||
| description: 'Deployment environment' | ||
| required: true | ||
| default: 'staging' | ||
| type: choice | ||
| options: | ||
| - staging | ||
| - production | ||
| env: | ||
| NODE_VERSION: '18.x' | ||
| REGISTRY: ghcr.io | ||
| IMAGE_NAME: ${{ github.repository }} | ||
| jobs: | ||
| # Build and Test (reuse from CI) | ||
| test: | ||
| uses: ./.github/workflows/ci.yml | ||
|
Check failure on line 26 in .github/workflows/deploy.yml
|
||
| # Deploy to Staging | ||
| deploy-staging: | ||
| name: Deploy to Staging | ||
| runs-on: ubuntu-latest | ||
| needs: test | ||
| if: github.ref == 'refs/heads/main' || (github.event_name == 'workflow_dispatch' && github.event.inputs.environment == 'staging') | ||
| environment: | ||
| name: staging | ||
| url: https://cam-staging.example.com | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: ${{ env.NODE_VERSION }} | ||
| cache: 'npm' | ||
| - name: Install dependencies | ||
| run: npm ci | ||
| - name: Build for staging | ||
| run: npm run build | ||
| env: | ||
| NODE_ENV: staging | ||
| CAM_API_BASE_URL: ${{ secrets.STAGING_API_BASE_URL }} | ||
| CAM_JWT_SECRET: ${{ secrets.STAGING_JWT_SECRET }} | ||
| - name: Deploy to AWS (Staging) | ||
| 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: us-east-1 | ||
| - name: Deploy to ECS (Staging) | ||
| run: | | ||
| aws ecs update-service \ | ||
| --cluster cam-staging-cluster \ | ||
| --service cam-arbitration-mesh \ | ||
| --force-new-deployment | ||
| - name: Run smoke tests | ||
| run: npm run test:smoke | ||
| env: | ||
| CAM_BASE_URL: https://cam-staging.example.com | ||
| - name: Notify deployment success | ||
| uses: 8398a7/action-slack@v3 | ||
| with: | ||
| status: success | ||
| channel: '#deployments' | ||
| text: '🚀 CAM successfully deployed to staging' | ||
| env: | ||
| SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | ||
| # Deploy to Production | ||
| deploy-production: | ||
| name: Deploy to Production | ||
| runs-on: ubuntu-latest | ||
| needs: deploy-staging | ||
| if: startsWith(github.ref, 'refs/tags/v') || (github.event_name == 'workflow_dispatch' && github.event.inputs.environment == 'production') | ||
| environment: | ||
| name: production | ||
| url: https://cam.example.com | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: ${{ env.NODE_VERSION }} | ||
| cache: 'npm' | ||
| - name: Install dependencies | ||
| run: npm ci | ||
| - name: Build for production | ||
| run: npm run build | ||
| env: | ||
| NODE_ENV: production | ||
| CAM_API_BASE_URL: ${{ secrets.PRODUCTION_API_BASE_URL }} | ||
| CAM_JWT_SECRET: ${{ secrets.PRODUCTION_JWT_SECRET }} | ||
| - name: Create deployment backup | ||
| 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: us-east-1 | ||
| - name: Backup current deployment | ||
| run: | | ||
| aws ecs describe-services \ | ||
| --cluster cam-production-cluster \ | ||
| --services cam-arbitration-mesh \ | ||
| > deployment-backup-$(date +%Y%m%d-%H%M%S).json | ||
| - name: Deploy to ECS (Production) | ||
| run: | | ||
| aws ecs update-service \ | ||
| --cluster cam-production-cluster \ | ||
| --service cam-arbitration-mesh \ | ||
| --force-new-deployment | ||
| - name: Wait for deployment completion | ||
| run: | | ||
| aws ecs wait services-stable \ | ||
| --cluster cam-production-cluster \ | ||
| --services cam-arbitration-mesh | ||
| - name: Run production health checks | ||
| run: npm run test:health | ||
| env: | ||
| CAM_BASE_URL: https://cam.example.com | ||
| - name: Rollback on failure | ||
| if: failure() | ||
| run: | | ||
| echo "Deployment failed, initiating rollback..." | ||
| # Rollback logic would go here | ||
| aws ecs update-service \ | ||
| --cluster cam-production-cluster \ | ||
| --service cam-arbitration-mesh \ | ||
| --task-definition $(cat deployment-backup-*.json | jq -r '.services[0].taskDefinition') | ||
| - name: Notify deployment success | ||
| uses: 8398a7/action-slack@v3 | ||
| with: | ||
| status: success | ||
| channel: '#deployments' | ||
| text: '🎉 CAM successfully deployed to production!' | ||
| env: | ||
| SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | ||
| - name: Notify deployment failure | ||
| if: failure() | ||
| uses: 8398a7/action-slack@v3 | ||
| with: | ||
| status: failure | ||
| channel: '#deployments' | ||
| text: '❌ CAM production deployment failed and was rolled back' | ||
| env: | ||
| SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | ||
| # Multi-cloud deployment | ||
| deploy-azure: | ||
| name: Deploy to Azure | ||
| runs-on: ubuntu-latest | ||
| needs: test | ||
| if: github.ref == 'refs/heads/main' | ||
| environment: | ||
| name: azure-staging | ||
| url: https://cam-azure.azurewebsites.net | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: ${{ env.NODE_VERSION }} | ||
| cache: 'npm' | ||
| - name: Install dependencies | ||
| run: npm ci | ||
| - name: Build for Azure | ||
| run: npm run build | ||
| env: | ||
| NODE_ENV: production | ||
| CAM_API_BASE_URL: ${{ secrets.AZURE_API_BASE_URL }} | ||
| - name: Deploy to Azure Web App | ||
| uses: azure/webapps-deploy@v2 | ||
| with: | ||
| app-name: cam-arbitration-mesh | ||
| publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }} | ||
| package: . | ||
| # GCP deployment | ||
| deploy-gcp: | ||
| name: Deploy to GCP | ||
| runs-on: ubuntu-latest | ||
| needs: test | ||
| if: github.ref == 'refs/heads/main' | ||
| environment: | ||
| name: gcp-staging | ||
| url: https://cam-gcp.run.app | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| - name: Setup Google Cloud CLI | ||
| uses: google-github-actions/setup-gcloud@v1 | ||
| with: | ||
| service_account_key: ${{ secrets.GCP_SA_KEY }} | ||
| project_id: ${{ secrets.GCP_PROJECT_ID }} | ||
| - name: Configure Docker for GCR | ||
| run: gcloud auth configure-docker | ||
| - name: Build and push to GCR | ||
| run: | | ||
| docker build -t gcr.io/${{ secrets.GCP_PROJECT_ID }}/cam-arbitration-mesh:${{ github.sha }} . | ||
| docker push gcr.io/${{ secrets.GCP_PROJECT_ID }}/cam-arbitration-mesh:${{ github.sha }} | ||
| - name: Deploy to Cloud Run | ||
| run: | | ||
| gcloud run deploy cam-arbitration-mesh \ | ||
| --image gcr.io/${{ secrets.GCP_PROJECT_ID }}/cam-arbitration-mesh:${{ github.sha }} \ | ||
| --platform managed \ | ||
| --region us-central1 \ | ||
| --allow-unauthenticated | ||