Build and Deploy Augur Site with Fork Risk Monitoring #4550
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: Build and Deploy Augur Site with Fork Risk Monitoring | |
| on: | |
| schedule: | |
| - cron: '0 * * * *' # Every hour | |
| workflow_dispatch: | |
| inputs: | |
| eth_rpc_url: | |
| description: 'Custom Ethereum RPC URL (optional)' | |
| required: false | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| permissions: | |
| contents: write | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: fork-risk-pipeline | |
| cancel-in-progress: false | |
| jobs: | |
| risk-monitor: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 1 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: '22' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Event cache | |
| uses: actions/cache@v5 | |
| with: | |
| path: public/cache/event-cache.json | |
| key: event-cache-v1 | |
| - name: Run fork risk calculation | |
| run: npm run build:fork-data | |
| env: | |
| ETH_RPC_URL: ${{ secrets.ETH_RPC_URL || '' }} | |
| CALCULATION_MODE: 'incremental' | |
| - name: Upload fork-risk data | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: fork-risk-data | |
| path: public/data/fork-risk.json | |
| retention-days: 1 | |
| build: | |
| needs: risk-monitor | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 1 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: '22' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Download fork-risk data | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: fork-risk-data | |
| path: public/data | |
| - name: Verify fork-risk data exists | |
| run: test -f public/data/fork-risk.json | |
| - name: Type check | |
| run: npm run typecheck | |
| - name: Lint | |
| run: npm run lint | |
| - name: Build site | |
| run: npm run build | |
| env: | |
| SITE_URL: ${{ vars.SITE_URL }} | |
| BASE_PATH: ${{ vars.BASE_PATH }} | |
| PUBLIC_GA_ID: ${{ vars.PUBLIC_GA_ID }} | |
| - name: Upload Pages artifact | |
| uses: actions/upload-pages-artifact@v4 | |
| with: | |
| path: dist/ | |
| deploy: | |
| needs: [risk-monitor, build] | |
| if: github.ref == 'refs/heads/main' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| pages: write | |
| id-token: write | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - name: Download build artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: github-pages | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v5 |