name: Deploy

on:
  push:
    branches: [master]

jobs:
  deploy:
    strategy:
      matrix:
        node-version: [14.x]
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Use Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@v1
        with:
          node-version: ${{ matrix.node-version }}
      - run: npm ci
      - run: node scripts/createAdapterList.js
      - name: Deploy infrastructure stack
        run: npm run deploy
        env:
          AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
          AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
          DATABASE_URL: ${{ secrets.DATABASE_URL }}
          ALCHEMY_CONNECTION_ARBITRUM: ${{ secrets.ALCHEMY_CONNECTION_ARBITRUM }}
          ALCHEMY_CONNECTION_ETHEREUM: ${{ secrets.ALCHEMY_CONNECTION_ETHEREUM }}
          ETHEREUM_RPC: ${{ secrets.ETHEREUM_RPC }}
          XDAI_RPC: ${{ secrets.XDAI_RPC }}
          CRONOS_RPC: ${{ secrets.CRONOS_RPC }}
          FANTOM_RPC: ${{ secrets.FANTOM_RPC }}
          OPTIMISM_RPC: ${{ secrets.OPTIMISM_RPC }}
          AVAX_RPC: ${{ secrets.AVAX_RPC }}
          TVL_SPIKE_WEBHOOK: ${{ secrets.TVL_SPIKE_WEBHOOK }}
          NEW_YIELDS_WEBHOOK: ${{ secrets.NEW_YIELDS_WEBHOOK }}
          STALE_PROJECTS_WEBHOOK: ${{ secrets.STALE_PROJECTS_WEBHOOK }}
