feat: add manual production promotion and deployment status

- Add manual trigger to promote-to-production workflow (type 'PROMOTE')
- Add deployment status check workflow for monitoring all environments
- Manual promotion allows skipping tests if staging already validated
- Status workflow shows current version and health of all environments
- Provides clear manual action options for production control
This commit is contained in:
Greg
2025-07-01 16:21:31 -07:00
parent bb61109330
commit 6ffbe5dc31
2 changed files with 114 additions and 1 deletions

91
.github/workflows/deployment-status.yml vendored Normal file
View File

@@ -0,0 +1,91 @@
name: Deployment Status Check
on:
workflow_dispatch:
schedule:
# Check deployment status every 4 hours
- cron: '0 */4 * * *'
jobs:
check-deployment-status:
name: Check All Environment Status
runs-on: ubuntu-latest
steps:
- name: Check Development Status
run: |
echo "🧪 Checking Development Environment..."
DEV_URL="https://game-2048-dev.game-2048-dev.dev.wa.darknex.us"
DEV_STATUS=$(curl -s -o /dev/null -w "%{http_code}" -L --max-time 30 "$DEV_URL" || echo "000")
DEV_VERSION=$(curl -s -L --max-time 30 "$DEV_URL" | grep -o '<title>[^<]*</title>' | sed 's/<title>\(.*\)<\/title>/\1/' || echo "Unknown")
echo "Development Status: HTTP $DEV_STATUS"
echo "Development Version: $DEV_VERSION"
echo "DEV_STATUS=$DEV_STATUS" >> $GITHUB_ENV
echo "DEV_VERSION=$DEV_VERSION" >> $GITHUB_ENV
- name: Check Staging Status
run: |
echo "🎭 Checking Staging Environment..."
STAGING_URL="https://game-2048-staging.game-2048-staging.staging.wa.darknex.us"
STAGING_STATUS=$(curl -s -o /dev/null -w "%{http_code}" -L --max-time 30 "$STAGING_URL" || echo "000")
STAGING_VERSION=$(curl -s -L --max-time 30 "$STAGING_URL" | grep -o '<title>[^<]*</title>' | sed 's/<title>\(.*\)<\/title>/\1/' || echo "Unknown")
echo "Staging Status: HTTP $STAGING_STATUS"
echo "Staging Version: $STAGING_VERSION"
echo "STAGING_STATUS=$STAGING_STATUS" >> $GITHUB_ENV
echo "STAGING_VERSION=$STAGING_VERSION" >> $GITHUB_ENV
- name: Check Production Status
run: |
echo "🚀 Checking Production Environment..."
PROD_URL="https://game-2048-prod.game-2048-prod.wa.darknex.us"
PROD_STATUS=$(curl -s -o /dev/null -w "%{http_code}" -L --max-time 30 "$PROD_URL" || echo "000")
PROD_VERSION=$(curl -s -L --max-time 30 "$PROD_URL" | grep -o '<title>[^<]*</title>' | sed 's/<title>\(.*\)<\/title>/\1/' || echo "Unknown")
echo "Production Status: HTTP $PROD_STATUS"
echo "Production Version: $PROD_VERSION"
echo "PROD_STATUS=$PROD_STATUS" >> $GITHUB_ENV
echo "PROD_VERSION=$PROD_VERSION" >> $GITHUB_ENV
- name: Create Status Summary
run: |
echo "## 🌐 Deployment Status Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "| Environment | Status | Version | URL |" >> $GITHUB_STEP_SUMMARY
echo "|-------------|--------|---------|-----|" >> $GITHUB_STEP_SUMMARY
# Development status
if [ "$DEV_STATUS" = "200" ]; then
DEV_ICON="✅"
else
DEV_ICON="❌"
fi
echo "| 🧪 Development | $DEV_ICON HTTP $DEV_STATUS | $DEV_VERSION | https://game-2048-dev.game-2048-dev.dev.wa.darknex.us |" >> $GITHUB_STEP_SUMMARY
# Staging status
if [ "$STAGING_STATUS" = "200" ]; then
STAGING_ICON="✅"
else
STAGING_ICON="❌"
fi
echo "| 🎭 Staging | $STAGING_ICON HTTP $STAGING_STATUS | $STAGING_VERSION | https://game-2048-staging.game-2048-staging.staging.wa.darknex.us |" >> $GITHUB_STEP_SUMMARY
# Production status
if [ "$PROD_STATUS" = "200" ]; then
PROD_ICON="✅"
else
PROD_ICON="❌"
fi
echo "| 🚀 Production | $PROD_ICON HTTP $PROD_STATUS | $PROD_VERSION | https://game-2048-prod.game-2048-prod.wa.darknex.us |" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### 🔧 Manual Actions Available" >> $GITHUB_STEP_SUMMARY
echo "- **Deploy to Production**: Run 'Deploy to Production' workflow (requires typing 'DEPLOY')" >> $GITHUB_STEP_SUMMARY
echo "- **Promote to Production**: Run 'Promote to Production' workflow (requires typing 'PROMOTE')" >> $GITHUB_STEP_SUMMARY
echo "- **Run Smoke Tests**: Run 'Smoke Tests' workflow on any environment" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "📅 **Generated**: $(date -u '+%Y-%m-%d %H:%M:%S UTC')" >> $GITHUB_STEP_SUMMARY

View File

@@ -6,13 +6,25 @@ on:
types: types:
- completed - completed
branches: [ staging ] branches: [ staging ]
workflow_dispatch:
inputs:
confirmation:
description: 'Type "PROMOTE" to confirm staging → production promotion'
required: true
skip_tests:
description: 'Skip staging tests (use only if staging is already validated)'
required: false
default: false
type: boolean
jobs: jobs:
test-staging-and-promote-to-main: test-staging-and-promote-to-main:
name: Test Staging and Promote to Main name: Test Staging and Promote to Main
runs-on: ubuntu-latest runs-on: ubuntu-latest
environment: staging environment: staging
if: ${{ github.event.workflow_run.conclusion == 'success' }} if: |
(github.event_name == 'workflow_dispatch' && github.event.inputs.confirmation == 'PROMOTE') ||
(github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success')
steps: steps:
- name: Checkout repository - name: Checkout repository
@@ -21,14 +33,24 @@ jobs:
ref: staging ref: staging
- name: Wait for staging smoke test results to settle - name: Wait for staging smoke test results to settle
if: github.event_name == 'workflow_run' || (github.event_name == 'workflow_dispatch' && github.event.inputs.skip_tests == 'false')
run: | run: |
echo "⏳ Staging smoke tests completed, proceeding with production promotion..." echo "⏳ Staging smoke tests completed, proceeding with production promotion..."
sleep 30 sleep 30
- name: Verify staging smoke tests passed - name: Verify staging smoke tests passed
if: github.event_name == 'workflow_run' || (github.event_name == 'workflow_dispatch' && github.event.inputs.skip_tests == 'false')
run: | run: |
echo "✅ Staging smoke tests passed - proceeding with auto-promotion to production" echo "✅ Staging smoke tests passed - proceeding with auto-promotion to production"
- name: Manual promotion confirmation
if: github.event_name == 'workflow_dispatch'
run: |
echo "🔒 Manual promotion to production confirmed"
echo "📋 Trigger: ${{ github.event_name }}"
echo "🎯 Confirmation: ${{ github.event.inputs.confirmation }}"
echo "⚡ Skip tests: ${{ github.event.inputs.skip_tests }}"
- name: Auto-promote staging to main branch - name: Auto-promote staging to main branch
uses: actions/github-script@v7 uses: actions/github-script@v7
with: with: