#!/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 <