Skip to content

Commit

Permalink
chore: setup studio deployments
Browse files Browse the repository at this point in the history
  • Loading branch information
facuspagnuolo committed Nov 12, 2023
1 parent 69a08cd commit 8b2873f
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 23 deletions.
24 changes: 13 additions & 11 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
uses: ./.github/actions/setup
- name: Deploy Arbitrum
env:
GRAPH_KEY: ${{ secrets.GRAPH_KEY }}
GRAPH_KEY: ${{ secrets.GRAPH_HOSTED_KEY }}
run: yarn deploy:arbitrum

deploy-aurora:
Expand All @@ -29,7 +29,7 @@ jobs:
uses: ./.github/actions/setup
- name: Deploy Aurora
env:
GRAPH_KEY: ${{ secrets.GRAPH_KEY }}
GRAPH_KEY: ${{ secrets.GRAPH_HOSTED_KEY }}
run: yarn deploy:aurora

deploy-avalanche:
Expand All @@ -42,7 +42,7 @@ jobs:
uses: ./.github/actions/setup
- name: Deploy Avalanche
env:
GRAPH_KEY: ${{ secrets.GRAPH_KEY }}
GRAPH_KEY: ${{ secrets.GRAPH_HOSTED_KEY }}
run: yarn deploy:avalanche

deploy-base:
Expand All @@ -55,7 +55,8 @@ jobs:
uses: ./.github/actions/setup
- name: Deploy Base
env:
GRAPH_KEY: ${{ secrets.GRAPH_KEY }}
VERSION_LABEL: ${{ github.sha }}
GRAPH_KEY: ${{ secrets.GRAPH_STUDIO_KEY }}
run: yarn deploy:base

deploy-bsc:
Expand All @@ -68,7 +69,7 @@ jobs:
uses: ./.github/actions/setup
- name: Deploy BSC
env:
GRAPH_KEY: ${{ secrets.GRAPH_KEY }}
GRAPH_KEY: ${{ secrets.GRAPH_HOSTED_KEY }}
run: yarn deploy:bsc

deploy-fantom:
Expand All @@ -81,7 +82,7 @@ jobs:
uses: ./.github/actions/setup
- name: Deploy Fantom
env:
GRAPH_KEY: ${{ secrets.GRAPH_KEY }}
GRAPH_KEY: ${{ secrets.GRAPH_HOSTED_KEY }}
run: yarn deploy:fantom

deploy-gnosis:
Expand All @@ -94,7 +95,7 @@ jobs:
uses: ./.github/actions/setup
- name: Deploy Gnosis
env:
GRAPH_KEY: ${{ secrets.GRAPH_KEY }}
GRAPH_KEY: ${{ secrets.GRAPH_HOSTED_KEY }}
run: yarn deploy:gnosis

deploy-mainnet:
Expand All @@ -107,7 +108,7 @@ jobs:
uses: ./.github/actions/setup
- name: Deploy Mainnet
env:
GRAPH_KEY: ${{ secrets.GRAPH_KEY }}
GRAPH_KEY: ${{ secrets.GRAPH_HOSTED_KEY }}
run: yarn deploy:mainnet

deploy-optimism:
Expand All @@ -120,7 +121,7 @@ jobs:
uses: ./.github/actions/setup
- name: Deploy Optimism
env:
GRAPH_KEY: ${{ secrets.GRAPH_KEY }}
GRAPH_KEY: ${{ secrets.GRAPH_HOSTED_KEY }}
run: yarn deploy:optimism

deploy-polygon:
Expand All @@ -133,7 +134,7 @@ jobs:
uses: ./.github/actions/setup
- name: Deploy Polygon
env:
GRAPH_KEY: ${{ secrets.GRAPH_KEY }}
GRAPH_KEY: ${{ secrets.GRAPH_HOSTED_KEY }}
run: yarn deploy:polygon

deploy-zkevm:
Expand All @@ -146,5 +147,6 @@ jobs:
uses: ./.github/actions/setup
- name: Deploy zkEVM
env:
GRAPH_KEY: ${{ secrets.GRAPH_KEY }}
GRAPH_KEY: ${{ secrets.GRAPH_STUDIO_KEY }}
VERSION_LABEL: ${{ github.sha }}
run: yarn deploy:zkevm
38 changes: 31 additions & 7 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ fi

# Remove previous manifest if there is any
if [ -f subgraph.yaml ]; then
echo 'Removing previous subgraph manifest...'
echo 'Removing previous subgraph manifest'
rm subgraph.yaml
fi

Expand All @@ -178,10 +178,34 @@ sed -i -e "s/{{feeControllerAddress}}/${FEE_CONTROLLER_ADDRESS}/g" subgraph.yaml
sed -i -e "s/{{blockNumber}}/${BLOCK_NUMBER}/g" subgraph.yaml
rm -f subgraph.yaml-e

# Build functions selector dictionary
echo "Building functions selector dictionary"
yarn ts-node ./scripts/build-permissions-dictionary.ts
# Build functions selectors dictionary
echo "Building functions selectors dictionary"
output=$(yarn ts-node ./scripts/build-permissions-dictionary.ts)

# Run codegen and build
rm -rf ./types && yarn graph codegen -o types
yarn graph build
# Check dictionary build status
if [ $? -ne 0 ]; then
echo "Error trying to build funcitons selectors dictionary with exit status $?"
echo "$output"
exit $?
fi

# Run codegen
echo "Generating graph types"
output=$(rm -rf ./types && yarn graph codegen -o types 2>&1)

# Check codegen status
if [ $? -ne 0 ]; then
echo "Error trying to run codegen with exit status $?"
echo "$output"
exit $?
fi

# Run build
output=$(yarn graph build 2>&1)

# Check build status
if [ $? -ne 0 ]; then
echo "Error trying to build subgraph with exit status $?"
echo "$output"
exit $?
fi
31 changes: 26 additions & 5 deletions scripts/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,32 @@ set -o errexit
# Run graph build
yarn build:$NETWORK

# Require $GRAPH_KEY to be set
if [[ -z "${GRAPH_KEY}" ]]; then
echo "Please set \$GRAPH_KEY to your The Graph deploy key to run this command."
exit 1
# Studio deployments
platform_base=studio
platform_zkevm=studio

# Load platform
if [[ -z $PLATFORM ]]; then
PLATFORM_VAR=platform_$NETWORK
PLATFORM=${!PLATFORM_VAR}
fi

# Deploy subgraph
graph deploy mimic-fi/v3-$NETWORK --product hosted-service --access-token "$GRAPH_KEY"
if [ "$PLATFORM" == "studio" ]; then
echo "Deploying $NETWORK to subgraph studio"
if [[ -z $VERSION_LABEL ]]; then
echo 'Please make sure a version label is provided'
exit 1
fi
yarn graph deploy mimic-v3-$NETWORK --studio --deploy-key $GRAPH_KEY -l $VERSION_LABEL
else
echo "Deploying $NETWORK to hosted service"
yarn graph deploy mimic-fi/v3-$NETWORK --product hosted-service --deploy-key $GRAPH_KEY
fi

# Check deployer status
if [ $? -ne 0 ]; then
echo "Error trying to deploy subgraph with exit status $?"
echo "$output"
exit $?
fi

0 comments on commit 8b2873f

Please sign in to comment.