-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
75 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
# config | ||
valid_chains=($(ls config | sed 's/\.json//g')) | ||
valid_providers=("goldsky") | ||
|
||
function exit_help { | ||
echo "Usage: $0 <version> tag <provider> <deploy_key>" | ||
echo " Example: $0 0.1.4 latest goldsky ABCDEA123" | ||
echo " chains: " ${valid_chains[@]} | ||
echo " providers: " ${valid_providers[@]} | ||
exit 1 | ||
} | ||
|
||
|
||
function tag_one_goldsky { | ||
SUBGRAPH=$1 | ||
VERSION=$2 | ||
TAG=$4 | ||
DEPLOY_KEY=$3 | ||
echo "Tagging $SUBGRAPH/$VERSION to $TAG" | ||
goldsky subgraph tag create $SUBGRAPH/$VERSION --token $DEPLOY_KEY --tag $TAG | ||
} | ||
|
||
function tag_one { | ||
VERSION=$1 | ||
TAG=$2 | ||
PROVIDER=$3 | ||
DEPLOY_KEY=$4 | ||
case $PROVIDER in | ||
"goldsky") | ||
tag_one_goldsky beefy-clm-$CHAIN $VERSION $DEPLOY_KEY | ||
;; | ||
esac | ||
} | ||
|
||
|
||
version=$1 | ||
if [ -z "$version" ]; then | ||
echo "version is required" | ||
exit_help | ||
fi | ||
if [[ ! $version =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | ||
echo "invalid version" | ||
exit_help | ||
fi | ||
|
||
|
||
tag=$2 | ||
if [ -z "$tag" ]; then | ||
echo "tag is required" | ||
exit_help | ||
fi | ||
|
||
provider=$3 | ||
if [ -z "$provider" ]; then | ||
echo "provider is required" | ||
exit_help | ||
fi | ||
if [[ ! " ${valid_providers[@]} " =~ " ${provider} " ]]; then | ||
echo "invalid provider $provider" | ||
exit_help | ||
fi | ||
|
||
deploy_key=$4 | ||
if [ -z "$deploy_key" ]; then | ||
echo "deploy key is required" | ||
exit_help | ||
fi | ||
|
||
for chain in ${valid_chains[@]}; do | ||
tag_one $version $tag $provider $deploy_key | ||
done |
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