-
Notifications
You must be signed in to change notification settings - Fork 4
54 lines (48 loc) · 1.58 KB
/
create-subgraph.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
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 18
uses: actions/setup-node@v3
with:
node-version: '18'
- 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/[email protected]
- 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
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 }}