Skip to content

Commit

Permalink
Refactor deployment scripts (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
Amxx committed Jun 14, 2022
1 parent 34132e8 commit 7bf974b
Show file tree
Hide file tree
Showing 12 changed files with 44 additions and 48 deletions.
4 changes: 3 additions & 1 deletion configs/live/bsc/admin.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,7 @@
{ "startBlock": 0, "module": "erc1967upgrade" },
{ "startBlock": 0, "module": "accesscontrol" }
],
"__endpoint": "https://api.thegraph.com/subgraphs/name/amxx/access-control-bsc"
"deploy": [
{ "type": "hosted-service", "name": "amxx/access-control-bsc" }
]
}
4 changes: 3 additions & 1 deletion configs/live/bsc/nfts.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@
{ "startBlock": 0, "module": "erc721" },
{ "startBlock": 0, "module": "erc1155" }
],
"__endpoint": "https://api.thegraph.com/subgraphs/name/amxx/nft-bsc"
"deploy": [
{ "type": "hosted-service", "name": "amxx/nft-bsc" }
]
}
4 changes: 3 additions & 1 deletion configs/live/mainnet/admin.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,7 @@
{ "startBlock": 5375569, "module": "erc1967upgrade" },
{ "startBlock": 9857098, "module": "accesscontrol" }
],
"__endpoint": "https://api.thegraph.com/subgraphs/name/amxx/access-control"
"deploy": [
{ "type": "hosted-service", "name": "amxx/access-control" }
]
}
4 changes: 3 additions & 1 deletion configs/live/mainnet/eip1155.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@
"datasources": [
{ "startBlock": 6930510, "module": "erc1155" }
],
"__endpoint": "https://api.thegraph.com/subgraphs/name/amxx/eip1155-subgraph"
"deploy": [
{ "type": "hosted-service", "name": "amxx/eip1155-subgraph" }
]
}
4 changes: 3 additions & 1 deletion configs/live/mainnet/eip721.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@
"datasources": [
{ "startBlock": 5806610, "module": "erc721" }
],
"__endpoint": "https://api.thegraph.com/subgraphs/name/amxx/eip721-subgraph"
"deploy": [
{ "type": "hosted-service", "name": "amxx/eip721-subgraph" }
]
}
4 changes: 3 additions & 1 deletion configs/live/mainnet/nfts.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@
{ "startBlock": 5806610, "module": "erc721" },
{ "startBlock": 6930510, "module": "erc1155" }
],
"__endpoint": "https://api.thegraph.com/subgraphs/name/amxx/nft-mainnet"
"deploy": [
{ "type": "hosted-service", "name": "amxx/nft-mainnet" }
]
}
4 changes: 3 additions & 1 deletion configs/live/matic/admin.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,7 @@
{ "startBlock": 0, "module": "erc1967upgrade" },
{ "startBlock": 0, "module": "accesscontrol" }
],
"__endpoint": "https://api.thegraph.com/subgraphs/name/amxx/access-control-matic"
"deploy": [
{ "type": "hosted-service", "name": "amxx/access-control-matic" }
]
}
4 changes: 3 additions & 1 deletion configs/live/matic/nfts.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@
{ "startBlock": 0, "module": "erc721" },
{ "startBlock": 0, "module": "erc1155" }
],
"__endpoint": "https://api.thegraph.com/subgraphs/name/amxx/nft-matic"
"deploy": [
{ "type": "hosted-service", "name": "amxx/nft-matic" }
]
}
4 changes: 3 additions & 1 deletion configs/live/xdai/admin.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,7 @@
{ "startBlock": 0, "module": "erc1967upgrade" },
{ "startBlock": 0, "module": "accesscontrol" }
],
"__endpoint": "https://api.thegraph.com/subgraphs/name/amxx/access-control-xdai"
"deploy": [
{ "type": "hosted-service", "name": "amxx/access-control-xdai" }
]
}
4 changes: 3 additions & 1 deletion configs/live/xdai/nfts.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@
{ "startBlock": 0, "module": "erc721" },
{ "startBlock": 0, "module": "erc1155" }
],
"__endpoint": "https://api.thegraph.com/subgraphs/name/amxx/nft-xdai"
"deploy": [
{ "type": "hosted-service", "name": "amxx/nft-xdai" }
]
}
21 changes: 0 additions & 21 deletions scripts/deploy-all.sh

This file was deleted.

31 changes: 14 additions & 17 deletions scripts/deploy.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
#!/usr/bin/env bash

set -o errexit
set -xo errexit

npx graph-compiler \
--config ${CONFIG:-configs/sample.json} \
--include src/datasources \
--export-subgraph \
--export-schema &&
# Default is to deploy all live configs
configs=$1
: ${configs:=configs/live/**/*.json}

npx graph codegen \
${SUBGRAPH:-generated/sample.subgraph.yaml} &&
for config in $configs;
do
subgraph=$(jq -r '.output' $config)
npx graph-compiler --config ${config} --include src/datasources --export-schema --export-subgraph
npx graph codegen ${subgraph}subgraph.yaml

npx graph build \
${SUBGRAPH:-generated/sample.subgraph.yaml} &&

npx graph deploy \
--product hosted-service \
${NAME:-amxx/sandbox} \
${SUBGRAPH:-generated/sample.subgraph.yaml} &&

echo 'done.'
jq -cr '.deploy[].type+" "+.deploy[].name' $config | while read endpoint;
do
npx graph deploy --product ${endpoint} ${subgraph}subgraph.yaml
done
done

0 comments on commit 7bf974b

Please sign in to comment.