Skip to content
This repository has been archived by the owner on Sep 7, 2023. It is now read-only.

Commit

Permalink
Add a deploy script
Browse files Browse the repository at this point in the history
  • Loading branch information
abishekk92 committed Mar 27, 2023
1 parent 30be33b commit 5ee1665
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/bash -n
# This script is used to deploy the program artifact to the Solana Cluster
# Usage: ./deploy.sh $PROGRAM_NAME $CLUSTER

# Check if the program name is provided
if [ -z "$1" ]; then
echo "Please provide the program name"
exit 1
fi

# Check if the cluster name is provided
if [ -z "$2" ]; then
echo "Please provide the cluster name"
exit 1
fi

# Call the correct function based on the cluster
if [ "$2" = "d" ]; then
deploy_devnet "$1"
elif [ "$2" = "m" ]; then
deploy_mainnet "$1"
else
echo "Please provide a valid cluster name"
exit 1
fi

# Function to deploy to devnet
function deploy_devnet() {
echo "Deploying to devnet"
goki deploy -c devnet -l target/deploy/"$1".so -p target/deploy/"$1"_keypair.json
}

# Function to deploy to mainnet
function deploy_mainnet() {
echo "Deploying to mainnet"
# Check if $MAINNET_AUTHORITY is set
if [ -z "$MAINNET_AUTHORITY" ]; then
echo "Please set the MAINNET_AUTHORITY environment variable"
exit 1
fi
anchor deploy --provider.wallet $MAINNET_AUTHORITY --provider.cluster mainnet target/deploy/"$1".so
}

0 comments on commit 5ee1665

Please sign in to comment.