Sync Trust Metrics #188
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: Sync Trust Metrics | |
| on: | |
| schedule: | |
| # Run daily at 22:00 UTC (07:00 KST next day) | |
| - cron: "0 22 * * *" | |
| workflow_dispatch: # Allow manual trigger | |
| jobs: | |
| sync: | |
| name: 🔄 Sync Trust Metrics | |
| runs-on: ubuntu-latest | |
| outputs: | |
| sync_success: ${{ steps.sync.outputs.success }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: latest | |
| - name: Install dependencies | |
| run: bun install --frozen-lockfile | |
| - name: Sync metrics to Supabase | |
| id: sync | |
| env: | |
| NEXT_PUBLIC_SUPABASE_URL: ${{ secrets.SUPABASE_URL }} | |
| NEXT_PUBLIC_SUPABASE_ANON_KEY: ${{ secrets.SUPABASE_ANON_KEY }} | |
| SUPABASE_SERVICE_ROLE_KEY: ${{ secrets.SUPABASE_SERVICE_ROLE_KEY }} | |
| run: | | |
| echo "🔄 Starting trust metrics sync..." | |
| bun run scripts/test-sync.ts apply | |
| echo "success=true" >> $GITHUB_OUTPUT | |
| echo "✅ Sync completed successfully" | |
| - name: Report sync failure | |
| if: failure() | |
| run: | | |
| echo "⚠️ Trust metrics sync failed. Check the logs above for details." | |
| rebuild: | |
| name: 🔨 Deploy to Netlify | |
| runs-on: ubuntu-latest | |
| needs: sync | |
| if: needs.sync.outputs.sync_success == 'true' | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: latest | |
| - name: Install dependencies | |
| run: bun install --frozen-lockfile | |
| - name: Build site | |
| env: | |
| NEXT_PUBLIC_SUPABASE_URL: ${{ secrets.SUPABASE_URL }} | |
| NEXT_PUBLIC_SUPABASE_ANON_KEY: ${{ secrets.SUPABASE_ANON_KEY }} | |
| run: bun run build | |
| - name: Deploy to Netlify | |
| run: | | |
| npx netlify-cli deploy \ | |
| --prod \ | |
| --dir=.next \ | |
| --auth=${{ secrets.NETLIFY_AUTH_TOKEN }} \ | |
| --site=${{ secrets.NETLIFY_SITE_ID }} | |
| timeout-minutes: 5 |