From a7810a34c90d5bfe0c6cc0697ad9aaf79b1c41d7 Mon Sep 17 00:00:00 2001 From: Eric Lewis Date: Thu, 29 Feb 2024 00:41:01 -0700 Subject: [PATCH] feat: one click deployer (#139) * feat: one click deployer This adds a script for deploying whatever is the latest on main, essentially automating the changes specified in the readme. * fix * repurpose existing script * clean up * fix * fix * Update latest record version --------- Co-authored-by: Nabarun --- packages/deployer/config.yml | 2 +- packages/deployer/deploy-frontend.sh | 68 +++++++++++++++++-- .../application-deployment-request.yml | 11 ++- .../deployer/records/application-record.yml | 8 +-- packages/frontend/package.json | 2 +- 5 files changed, 73 insertions(+), 18 deletions(-) diff --git a/packages/deployer/config.yml b/packages/deployer/config.yml index 2c6410df..f65a3bfc 100644 --- a/packages/deployer/config.yml +++ b/packages/deployer/config.yml @@ -3,7 +3,7 @@ services: restEndpoint: http://console.laconic.com:1317 gqlEndpoint: http://console.laconic.com:9473/api chainId: laconic_9000-1 - gas: 1000000 + gas: 1200000 fees: 200000aphoton userKey: 0524fc22ea0a12e6c5cc4cfe08e73c95dffd0ab5ed72a59f459ed33134fa3b16 bondId: 8fcf44b2f326b4b63ac57547777f1c78b7d494e5966e508f09001af53cb440ac diff --git a/packages/deployer/deploy-frontend.sh b/packages/deployer/deploy-frontend.sh index 1e56f47a..3bff6698 100755 --- a/packages/deployer/deploy-frontend.sh +++ b/packages/deployer/deploy-frontend.sh @@ -1,11 +1,71 @@ #!/bin/bash +# Repository URL +REPO_URL="https://git.vdb.to/cerc-io/snowballtools-base" + +# Get the latest commit hash from the repository +LATEST_HASH=$(git ls-remote $REPO_URL HEAD | awk '{print $1}') + +# Extract version from ../frontend/package.json +PACKAGE_VERSION=$(jq -r '.version' ../frontend/package.json) + +# Current date and time for note +CURRENT_DATE_TIME=$(date -u) + +# Increment application-record version +APPLICATION_RECORD_FILE="./records/application-record.yml" +if [ -f "$APPLICATION_RECORD_FILE" ]; then + # Extract current version and increment it + CURRENT_VERSION=$(grep 'version:' $APPLICATION_RECORD_FILE | head -1 | awk '{print $2}') + IFS='.' read -ra ADDR <<< "$CURRENT_VERSION" + VERSION_NUMBER=${ADDR[2]} + NEW_VERSION_NUMBER=$((VERSION_NUMBER + 1)) + NEW_APPLICATION_VERSION="${ADDR[0]}.${ADDR[1]}.$NEW_VERSION_NUMBER" +else + # If file does not exist, start from version 0.0.1 + NEW_APPLICATION_VERSION="0.0.1" +fi + +# Generate application-deployment-request.yml +cat > ./records/application-deployment-request.yml < ./records/application-record.yml <