diff --git a/deploy-frontend.sh b/deploy-frontend.sh new file mode 100755 index 00000000..b09c1d26 --- /dev/null +++ b/deploy-frontend.sh @@ -0,0 +1,142 @@ +#!/bin/bash + +source .env +echo "Using REGISTRY_BOND_ID: $REGISTRY_BOND_ID" +echo "Using DEPLOYER_LRN: $DEPLOYER_LRN" +echo "Using AUTHORITY: $AUTHORITY" + +# Repository URL +REPO_URL="https://git.vdb.to/cerc-io/cosmos-explorer" + +# Get the latest commit hash from the repository +LATEST_HASH=$(git ls-remote $REPO_URL HEAD | awk '{print $1}') + +PACKAGE_VERSION=0.0.2 + +# Current date and time for note +CURRENT_DATE_TIME=$(date -u) + +CONFIG_FILE=config.yml + +# Reference: https://git.vdb.to/cerc-io/test-progressive-web-app/src/branch/main/scripts + +# Get latest version from registry and increment application-record version +NEW_APPLICATION_VERSION=$(laconic -c $CONFIG_FILE registry record list --type ApplicationRecord --all --name "deploy-frontend" 2>/dev/null | jq -r -s ".[] | sort_by(.createTime) | reverse | [ .[] | select(.bondId == \"$REGISTRY_BOND_ID\") ] | .[0].attributes.version" | awk -F. -v OFS=. '{$NF += 1 ; print}') + +if [ -z "$NEW_APPLICATION_VERSION" ] || [ "1" == "$NEW_APPLICATION_VERSION" ]; then + # Set application-record version if no previous records were found + NEW_APPLICATION_VERSION=0.0.1 +fi + +# Generate application-record.yml with incremented version +cat >./records/application-record.yml <./records/application-deployment-request.yml <