#!/bin/bash # Fail on error set -e source .registry.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/deep-stack/sol-mem-gen" # Get the latest commit hash from the repository LATEST_HASH=$(git ls-remote $REPO_URL HEAD | awk '{print $1}') PACKAGE_VERSION=$(curl -s $REPO_URL/raw/branch/main/package.json | jq -r .version) APP_NAME=sol-mem-gen echo "Repo: ${REPO_URL}" echo "Latest hash: ${LATEST_HASH}" echo "App version: ${PACKAGE_VERSION}" echo "Deployment DNS: ${DEPLOYMENT_DNS}" # 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 "$APP_NAME" 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 mkdir records RECORD_FILE=./records/application-record.yml cat >$RECORD_FILE <