Create subgraph #11
This file contains 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: 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 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install Node.js and Yarn | |
run: | | |
curl -fsSL https://deb.nodesource.com/setup_14.x | sudo -E bash - | |
sudo apt-get install -y nodejs | |
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 yarn | |
- name: Install graph-cli | |
run: | | |
sudo yarn global add @graphprotocol/graph-cli | |
- name: Install yq | |
run: | | |
sudo add-apt-repository ppa:rmescandon/yq | |
sudo apt update | |
sudo apt install yq -y | |
yq --version | |
- name: Read sub.folder.name from folder.yaml and create subgraph | |
run: | | |
if [ "${{ github.event.inputs.environment }}" == "development" ]; then | |
NODE_URL="$DEV_NODE_URL" | |
else | |
NODE_URL="$PROD_NODE_URL" | |
fi | |
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 }} |