Skip to content

Build and Deploy Augur Site with Fork Risk Monitoring #5996

Build and Deploy Augur Site with Fork Risk Monitoring

Build and Deploy Augur Site with Fork Risk Monitoring #5996

name: Build and Deploy Augur Site with Fork Risk Monitoring
on:
schedule:
- cron: '0 * * * *' # Every hour
workflow_dispatch:
push:
branches:
- main
pull_request:
branches:
- main
# Read-only by default; the deploy job declares its own pages/id-token grants
permissions:
contents: read
# Ref-scoped so PR runs can never displace a pending main/cron deploy run;
# superseded PR runs are cancelled instead of queueing.
concurrency:
group: fork-risk-pipeline-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
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@v7
with:
name: fork-risk-data
path: public/data/fork-risk.json
retention-days: 1
rep-supply:
runs-on: ubuntu-latest
timeout-minutes: 10
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: Generate REP supply endpoints
run: npm run build:supply-data
env:
ETH_RPC_URL: ${{ secrets.ETH_RPC_URL || '' }}
- name: Upload supply data
uses: actions/upload-artifact@v7
with:
name: supply-data
path: public/api/supply/
retention-days: 1
build:
needs: [risk-monitor, rep-supply]
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@v8
with:
name: fork-risk-data
path: public/data
- name: Verify fork-risk data exists
run: test -f public/data/fork-risk.json
- name: Download supply data
uses: actions/download-artifact@v8
with:
name: supply-data
path: public/api/supply
- name: Verify supply endpoints exist
run: |
test -s public/api/supply/meta.json
for field in total circulating; do
test -s "public/api/supply/$field/index.html"
done
- name: Check
run: npm run check
- name: Test migration archive
run: npm run test:migration-archive
- 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@v5
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@v8
with:
name: github-pages
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v5