-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.sh
More file actions
executable file
·64 lines (55 loc) · 1.44 KB
/
deploy.sh
File metadata and controls
executable file
·64 lines (55 loc) · 1.44 KB
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
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/env bash
# Exit script as soon as a command fails.
set -o errexit
# Exporting variables from the env file and making them available in the code below
set -a
source .env
set +a
rm -rf build/ generated/
# Generates files from templates
mustache config/$CONFIG ./src/generated/config.template.txt > ./src/generated/config.ts
mustache config/$CONFIG subgraph.template.yaml > subgraph.yaml
# Run codegen and build
graph codegen
graph build
if [[ "$NO_DEPLOY" = true ]]; then
rm subgraph.yaml
exit 0
fi
if [ "$NETWORK" == "mainnet" ]
then
SUBGRAPH_NAME=$ORG_SLASH_REPO
else
SUBGRAPH_NAME=$ORG_SLASH_REPO-$NETWORK
fi
# Select IPFS and The Graph nodes
if [ "$TARGET" == "local" ] || [ "$TARGET" == "remote" ]
then
if [ "$TARGET" == "local" ]
then
IPFS_NODE="http://localhost:5001"
GRAPH_NODE="http://127.0.0.1:8020"
fi
# Create subgraph if missing
{
graph create $SUBGRAPH_NAME --node $GRAPH_NODE
} || {
echo 'Subgraph was already created'
}
# Deploy subgraph
graph deploy $SUBGRAPH_NAME --ipfs $IPFS_NODE --node $GRAPH_NODE
elif [ "$TARGET" = "studio" ]
then
# The Graph auth
graph auth --studio hosted-service $ACCESS_TOKEN
# Deploy subgraph
graph deploy --studio $SUBGRAPH_NAME
elif [ "$TARGET" = "hosted-service" ]
then
# The Graph auth
graph auth --product hosted-service $ACCESS_TOKEN
# Deploy subgraph
graph deploy --product hosted-service $SUBGRAPH_NAME
fi
# Remove manifest
rm subgraph.yaml