fix(wallet): fetch activeTranscoderCount and delegatorsCount from sub… #202
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
| # ============================================================================= | |
| # Deploy Pipeline — Production / Rollback | |
| # ============================================================================= | |
| # - Push to main → deploy to production (Vercel --prod) | |
| # - Manual dispatch → rollback production | |
| # | |
| # Branch model: feature-branch-off-main (trunk-based). | |
| # Staging is handled by Vercel PR previews (automatic for every PR). | |
| # ============================================================================= | |
| name: Deploy | |
| on: | |
| push: | |
| branches: [main] | |
| workflow_dispatch: | |
| inputs: | |
| action: | |
| description: 'Deployment action' | |
| required: true | |
| default: 'rollback' | |
| type: choice | |
| options: | |
| - rollback | |
| concurrency: | |
| group: deploy-${{ github.ref }} | |
| cancel-in-progress: false | |
| env: | |
| VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} | |
| VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} | |
| jobs: | |
| # =========================================================================== | |
| # Deploy Production — Triggered on push to main | |
| # =========================================================================== | |
| deploy-production: | |
| name: Deploy Production | |
| runs-on: ubuntu-latest | |
| if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
| environment: | |
| name: production | |
| url: https://naap.dev | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| - name: Install Vercel CLI | |
| run: npm install -g vercel@latest | |
| - name: Pull Vercel environment (production) | |
| run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }} | |
| - name: Build for production | |
| run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }} | |
| - name: Deploy to production | |
| run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }} | |
| - name: Health check | |
| run: | | |
| echo "Waiting 30s for deployment to stabilize..." | |
| sleep 30 | |
| HTTP_STATUS=$(curl -s -o /dev/null -w "%{http_code}" https://naap.dev/api/health || echo "000") | |
| if [ "$HTTP_STATUS" != "200" ]; then | |
| echo "::error::Health check failed with status: ${HTTP_STATUS}" | |
| echo "Initiating automatic rollback..." | |
| vercel rollback --token=${{ secrets.VERCEL_TOKEN }} | |
| exit 1 | |
| fi | |
| echo "Health check passed (HTTP 200)" | |
| - name: Post deployment status | |
| if: always() | |
| run: | | |
| echo "## Production Deployment" >> $GITHUB_STEP_SUMMARY | |
| echo "- **URL:** https://naap.dev" >> $GITHUB_STEP_SUMMARY | |
| echo "- **Commit:** \`${{ github.sha }}\`" >> $GITHUB_STEP_SUMMARY | |
| echo "- **Status:** ${{ job.status }}" >> $GITHUB_STEP_SUMMARY | |
| # =========================================================================== | |
| # Post-Deploy E2E Smoke — Runs @pre-release suite against production | |
| # =========================================================================== | |
| e2e-smoke: | |
| name: Post-Deploy E2E Smoke | |
| runs-on: ubuntu-latest | |
| needs: deploy-production | |
| if: needs.deploy-production.result == 'success' | |
| timeout-minutes: 15 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Install Playwright browsers | |
| run: npx playwright install --with-deps chromium | |
| working-directory: apps/web-next | |
| # Teams E2E skips when enableTeams is false (see apps/web-next/tests/teams.spec.ts). | |
| - name: Run E2E pre-release smoke | |
| run: npx playwright test --grep @pre-release --grep-invert @appendix-preview --project=chromium | |
| working-directory: apps/web-next | |
| env: | |
| PLAYWRIGHT_BASE_URL: https://naap-platform.vercel.app | |
| E2E_USER_EMAIL: ${{ secrets.E2E_USER_EMAIL }} | |
| E2E_USER_PASSWORD: ${{ secrets.E2E_USER_PASSWORD }} | |
| CI: true | |
| - name: Upload E2E results | |
| if: always() | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: e2e-smoke-results | |
| path: | | |
| apps/web-next/test-results/ | |
| apps/web-next/playwright-report/ | |
| retention-days: 14 | |
| - name: Post E2E summary | |
| if: always() | |
| run: | | |
| echo "## Post-Deploy E2E Smoke" >> $GITHUB_STEP_SUMMARY | |
| echo "- **Target:** https://naap-platform.vercel.app" >> $GITHUB_STEP_SUMMARY | |
| echo "- **Suite:** @pre-release (GA modules)" >> $GITHUB_STEP_SUMMARY | |
| echo "- **Status:** ${{ job.status }}" >> $GITHUB_STEP_SUMMARY | |
| - name: Send email on failure | |
| if: failure() | |
| uses: dawidd6/action-send-mail@v5 | |
| with: | |
| server_address: ${{ secrets.SMTP_SERVER }} | |
| server_port: ${{ secrets.SMTP_PORT }} | |
| username: ${{ secrets.SMTP_USERNAME }} | |
| password: ${{ secrets.SMTP_PASSWORD }} | |
| subject: "❌ Post-Deploy E2E FAILED — NaaP Platform" | |
| to: ${{ secrets.E2E_NOTIFY_EMAIL }} | |
| from: "NaaP E2E <${{ secrets.SMTP_USERNAME }}>" | |
| body: | | |
| Post-Deploy E2E Smoke FAILED | |
| ============================== | |
| Commit: ${{ github.sha }} | |
| Target: https://naap-platform.vercel.app | |
| Run: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
| The post-deploy E2E smoke test failed after a production deployment. | |
| Please investigate immediately. | |
| View results and download artifacts: | |
| ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
| continue-on-error: true | |
| # =========================================================================== | |
| # Rollback — Manual trigger only | |
| # =========================================================================== | |
| rollback: | |
| name: Rollback Production | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'workflow_dispatch' | |
| environment: | |
| name: production | |
| url: https://naap.dev | |
| steps: | |
| - name: Install Vercel CLI | |
| run: npm install -g vercel@latest | |
| - name: Rollback to previous deployment | |
| run: | | |
| echo "Rolling back production deployment..." | |
| vercel rollback --token=${{ secrets.VERCEL_TOKEN }} | |
| echo "Rollback complete." | |
| - name: Verify rollback | |
| run: | | |
| sleep 15 | |
| HTTP_STATUS=$(curl -s -o /dev/null -w "%{http_code}" https://naap.dev/api/health || echo "000") | |
| echo "Post-rollback health check: HTTP ${HTTP_STATUS}" | |
| if [ "$HTTP_STATUS" != "200" ]; then | |
| echo "::warning::Post-rollback health check returned ${HTTP_STATUS}" | |
| fi | |
| - name: Post rollback status | |
| if: always() | |
| run: | | |
| echo "## Production Rollback" >> $GITHUB_STEP_SUMMARY | |
| echo "- **Triggered by:** ${{ github.actor }}" >> $GITHUB_STEP_SUMMARY | |
| echo "- **Status:** ${{ job.status }}" >> $GITHUB_STEP_SUMMARY |