diff --git a/.github/workflows/deployment-status.yml b/.github/workflows/deployment-status.yml new file mode 100644 index 0000000..ca97092 --- /dev/null +++ b/.github/workflows/deployment-status.yml @@ -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 '[^<]*' | sed 's/\(.*\)<\/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>[^<]*' | sed 's/\(.*\)<\/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>[^<]*' | sed 's/\(.*\)<\/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 diff --git a/.github/workflows/promote-to-production.yml b/.github/workflows/promote-to-production.yml index 2152353..3f9744a 100644 --- a/.github/workflows/promote-to-production.yml +++ b/.github/workflows/promote-to-production.yml @@ -6,13 +6,25 @@ on: types: - completed 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: test-staging-and-promote-to-main: name: Test Staging and Promote to Main runs-on: ubuntu-latest 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: - name: Checkout repository @@ -21,14 +33,24 @@ jobs: ref: staging - 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: | echo "โณ Staging smoke tests completed, proceeding with production promotion..." sleep 30 - name: Verify staging smoke tests passed + if: github.event_name == 'workflow_run' || (github.event_name == 'workflow_dispatch' && github.event.inputs.skip_tests == 'false') run: | 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 uses: actions/github-script@v7 with: