diff --git a/scripts/testnet/config_example.sh b/scripts/testnet/config_example.sh index 8a3e39fe..d9dae15d 100644 --- a/scripts/testnet/config_example.sh +++ b/scripts/testnet/config_example.sh @@ -6,6 +6,12 @@ WASMVM_VERSION=v1.5.2 WASM_PERMISSION_EVERYONE=true # true for everyone and false for mainnet configuration SHORT_VOTING_PERIOD=true # true for 180s voting period or false for mainnet configuration +# If DOWNLOAD_FROM_RELEASE is set to false, specify RUN_NO and ARTIFACT_NO so the script +# can download the artifact. +DOWNLOAD_FROM_RELEASE=false +RUN_NO=0123 +ARTIFACT_NO=0123 + LOCAL_BIN=$(git rev-parse --show-toplevel)/build/sedad # chain binary executable on your machine HOME_DIR=$HOME/.sedad # chain directory HOME_CONFIG_DIR=$HOME_DIR/config # chain config directory diff --git a/scripts/testnet/upload_and_start.sh b/scripts/testnet/upload_and_start.sh index 305f8b5a..4a5500d7 100755 --- a/scripts/testnet/upload_and_start.sh +++ b/scripts/testnet/upload_and_start.sh @@ -31,30 +31,26 @@ if [ ! -f "$LOCAL_BIN" ]; then exit 1 fi -# Download chain binaries - -# From release: -# curl -LO https://github.com/sedaprotocol/seda-chain/releases/download/$CHAIN_VERSION/sedad-amd64 -# curl -LO https://github.com/sedaprotocol/seda-chain/releases/download/$CHAIN_VERSION/sedad-arm64 - -# From artifact: -RUN_NO=8941156340 -ARTIFACT_NO=1471046522 - -set +x -url=$(curl -H "Authorization: token $GITHUB_TOKEN" \ - -H "Accept: application/vnd.github.v3+json" \ - https://api.github.com/repos/sedaprotocol/seda-chain/actions/runs/$RUN_NO/artifacts | \ - jq -r '.artifacts[] | select(.id=='"$ARTIFACT_NO"') | .archive_download_url') -curl -L -o artifact.zip \ - -H "Authorization: token $GITHUB_TOKEN" \ - $url -set -x - -unzip artifact.zip - -mv sedad-amd64 $NODE_DIR -mv sedad-arm64 $NODE_DIR +if [ "$DOWNLOAD_FROM_RELEASE" = "true" ]; then + # Download chain binaries from releases + curl -LO https://github.com/sedaprotocol/seda-chain/releases/download/$CHAIN_VERSION/sedad-amd64 + curl -LO https://github.com/sedaprotocol/seda-chain/releases/download/$CHAIN_VERSION/sedad-arm64 +else + # Download chain binaries from artifacts + set +x + url=$(curl -H "Authorization: token $GITHUB_TOKEN" \ + -H "Accept: application/vnd.github.v3+json" \ + https://api.github.com/repos/sedaprotocol/seda-chain/actions/runs/$RUN_NO/artifacts | \ + jq -r '.artifacts[] | select(.id=='"$ARTIFACT_NO"') | .archive_download_url') + curl -L -o artifact.zip \ + -H "Authorization: token $GITHUB_TOKEN" \ + $url + set -x + + unzip artifact.zip + mv sedad-amd64 $NODE_DIR + mv sedad-arm64 $NODE_DIR +fi ################################################