Skip to content

Create subgraph

Create subgraph #26

name: Create subgraph
on:
workflow_dispatch:
inputs:
environment:
description: 'dev/prod env'
default: 'development'
type: choice
required: true
options:
- development
- production
subgraph_name:
description: 'subgraph name'
required: true
type: string
jobs:
create-subgraph:
environment: development
runs-on:
- self-hosted
- ${{ (github.event.inputs.environment == 'development' && 'subgraphs-dev') || (github.event.inputs.environment == 'production' && 'subgraphs-prod') }}
steps:
- uses: actions/checkout@v3
- name: Set up Node.js 16
uses: actions/setup-node@v3
with:
node-version: '16'
- name: Install Yarn
run: |
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update && sudo apt-get install -y yarn
- name: Install graph-cli
run: |
sudo yarn global add @graphprotocol/graph-cli
- name: Create subgraph based on environment
run: |
if [ "${{ github.event.inputs.environment }}" == "development" ]; then
NODE_URL="$DEV_NODE_URL"
else
NODE_URL="$PROD_NODE_URL"
fi
echo $NODE_URL
echo $SUBGRAPH_NAME
graph create --node $NODE_URL $SUBGRAPH_NAME
env:
DEV_NODE_URL: ${{ secrets.DEV_NODE_URL }}
PROD_NODE_URL: ${{ secrets.PROD_NODE_URL }}
SUBGRAPH_NAME: ${{ github.event.inputs.subgraph_name }}