Skip to content

Added Github workflow for continuous deployment of contracts to Neutron testnet #17

Added Github workflow for continuous deployment of contracts to Neutron testnet

Added Github workflow for continuous deployment of contracts to Neutron testnet #17

name: Deploy contracts on Neutron testnet
on:
push:
branches: [ "main" ]
pull_request:
jobs:
deploy-latest-contracts:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Download Neutron chain binary
run: |
curl -L -o neutrond https://github.com/neutron-org/neutron/releases/download/v5.0.2/neutrond-linux-amd64
chmod +x neutrond
echo "$(pwd)" >> $GITHUB_PATH
- name: Checkout Neutron ICQ relayer repository
uses: actions/checkout@v4
with:
repository: neutron-org/neutron-query-relayer
path: ./neutron-query-relayer # directory to checkout the repo into
ref: 'refs/tags/v0.3.0' # tag to checkout
- name: Deploy contracts
env:
TESTNET_MNEMONIC: ${{ secrets.E2E_TESTS_MNEMONIC }}
run: |
CONFIG_FILE="./tools/deployment/config_testnet.json"
TX_SENDER_WALLET=$(jq -r '.tx_sender_wallet' $CONFIG_FILE)
echo $TESTNET_MNEMONIC | ./neutrond keys add $TX_SENDER_WALLET --keyring-backend test --recover
chmod +x ./tools/deployment/setup.sh
bash ./tools/deployment/setup.sh $CONFIG_FILE true
- name: Run ICQs setup script
run: |
echo $HYDRO_CONTRACT_ADDRESS
cp ./tools/script.sh .
chmod +x script.sh
CONFIG_FILE="./tools/deployment/config_testnet.json"
CHAIN_ID=$(echo $(jq -r '.chain_id' $CONFIG_FILE) | sed -E 's/([][\/.*?$^&|])/\\\1/g')
NEUTRON_RPC_NODE=$(echo $(jq -r '.neutron_rpc_node' $CONFIG_FILE) | sed -E 's/([][\/.*?$^&|])/\\\1/g')
NEUTRON_API_NODE=$(echo $(jq -r '.neutron_api_node' $CONFIG_FILE) | sed -E 's/([][\/.*?$^&|])/\\\1/g')
TX_SENDER_WALLET=$(echo $(jq -r '.tx_sender_wallet' $CONFIG_FILE) | sed -E 's/([][\/.*?$^&|])/\\\1/g')
HUB_CONNECTION_ID=$(echo $(jq -r '.hub_connection_id' $CONFIG_FILE) | sed -E 's/([][\/.*?$^&|])/\\\1/g')
HUB_RPC_NODE=$(echo $(jq -r '.hub_rpc_node' $CONFIG_FILE) | sed -E 's/([][\/.*?$^&|])/\\\1/g')
HUB_API_NODE=$(echo $(jq -r '.hub_api_node' $CONFIG_FILE) | sed -E 's/([][\/.*?$^&|])/\\\1/g')
sed -i "s|^RELAYER_REPO_PATH=.*$|RELAYER_REPO_PATH=\.\/neutron-query-relayer|" ./script.sh
sed -i "s/^export NEUTRON_CHAIN_ID=.*$/export NEUTRON_CHAIN_ID=$CHAIN_ID/" ./script.sh
sed -i "s/^export RELAYER_NEUTRON_CHAIN_RPC_ADDR=.*$/export RELAYER_NEUTRON_CHAIN_RPC_ADDR=$NEUTRON_RPC_NODE/" ./script.sh
sed -i "s/^export RELAYER_NEUTRON_CHAIN_REST_ADDR=.*$/export RELAYER_NEUTRON_CHAIN_REST_ADDR=$NEUTRON_API_NODE/" ./script.sh
sed -i "s/^export RELAYER_NEUTRON_CHAIN_SIGN_KEY_NAME=.*$/export RELAYER_NEUTRON_CHAIN_SIGN_KEY_NAME=$TX_SENDER_WALLET/" ./script.sh
sed -i "s/^export RELAYER_NEUTRON_CHAIN_CONNECTION_ID=.*$/export RELAYER_NEUTRON_CHAIN_CONNECTION_ID=$HUB_CONNECTION_ID/" ./script.sh
sed -i "s/^export RELAYER_TARGET_CHAIN_RPC_ADDR=.*$/export RELAYER_TARGET_CHAIN_RPC_ADDR=$HUB_RPC_NODE/" ./script.sh
sed -i "s/^export RELAYER_TARGET_CHAIN_API_ADDR=.*$/export RELAYER_TARGET_CHAIN_API_ADDR=$HUB_API_NODE/" ./script.sh
sed -i "s/^export RELAYER_REGISTRY_ADDRESSES=.*$/export RELAYER_REGISTRY_ADDRESSES=$HYDRO_CONTRACT_ADDRESS/" ./script.sh
sed -i "s/^export BATCH_SIZE=.*$/export BATCH_SIZE=5/" ./script.sh
sed -i "s/^export NUM_VALIDATORS_TO_ADD=.*$/export NUM_VALIDATORS_TO_ADD=5/" ./script.sh
sed -i "s/^export RELAYER_STORAGE_PATH=.*$/export RELAYER_STORAGE_PATH=\.neutron_queries_relayer\/leveldb/" ./script.sh
sed -i "s|^go run main\.go.*$|go run \./tools/main\.go|" ./script.sh
bash ./script.sh