From 5d0dc3d29a59fadd0b0788f08625cf5a3b646fb1 Mon Sep 17 00:00:00 2001 From: colin Date: Thu, 3 Jul 2025 13:34:47 -0400 Subject: [PATCH] Update versionbump.sh to use VERSION file as source of truth for web UI --- VERSION | 2 +- docker-compose.yml | 1 + version_history.log | 1 + versionbump.sh | 32 +++++++++++++++++++++----------- 4 files changed, 24 insertions(+), 12 deletions(-) diff --git a/VERSION b/VERSION index 6e8bf73..17e51c3 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.1.0 +0.1.1 diff --git a/docker-compose.yml b/docker-compose.yml index e18e08c..fed5545 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -17,6 +17,7 @@ services: - POSTGRES_DB=ploughshares - POSTGRES_USER=ploughshares - POSTGRES_PASSWORD=ploughshares_password + - APP_VERSION=0.1.1 depends_on: db: condition: service_healthy diff --git a/version_history.log b/version_history.log index e69de29..e19a801 100644 --- a/version_history.log +++ b/version_history.log @@ -0,0 +1 @@ +Thu Jul 3 13:33:04 EDT 2025: Version changed from 0.1.0 to 0.1.1 diff --git a/versionbump.sh b/versionbump.sh index 10e4100..661ad8d 100755 --- a/versionbump.sh +++ b/versionbump.sh @@ -29,8 +29,10 @@ DESCRIPTION: It updates the version in multiple locations: 1. The VERSION file (source of truth) - 2. Console log messages in app.py - 3. Docker Compose environment variables + 2. Docker Compose environment variables + + The web UI and application will automatically read the version from the + VERSION file at the root of the repository. After running this script, you need to rebuild and restart the application for the changes to take effect. @@ -74,16 +76,24 @@ update_version_everywhere() { # 2. Log the version change echo "$(date): Version changed from $CURRENT_VERSION to $NEW_VERSION" >> version_history.log - # 3. Update version in console log messages - # This ensures the version is visible in logs when the app starts - sed -i.bak "s/print(f\"Connected to PostgreSQL at/print(f\"Ploughshares v$NEW_VERSION - Connected to PostgreSQL at/" docker/ploughshares/app.py - rm -f docker/ploughshares/app.py.bak - echo "Updated version in app.py console logs" - - # 4. Update version in docker-compose.yml - sed -i.bak "s/APP_VERSION=.*/APP_VERSION=$NEW_VERSION/" "$DOCKER_COMPOSE_FILE" + # 3. Update version in docker-compose.yml + # Add APP_VERSION environment variable if it doesn't exist + if ! grep -q "APP_VERSION=" "$DOCKER_COMPOSE_FILE"; then + # Find the environment section for the app service + LINE_NUM=$(grep -n "environment:" "$DOCKER_COMPOSE_FILE" | head -1 | cut -d: -f1) + if [ -n "$LINE_NUM" ]; then + # Insert APP_VERSION after the environment line + sed -i.bak "${LINE_NUM}a\\ - APP_VERSION=$NEW_VERSION" "$DOCKER_COMPOSE_FILE" + echo "Added APP_VERSION=$NEW_VERSION to $DOCKER_COMPOSE_FILE" + else + echo "Warning: Could not find environment section in $DOCKER_COMPOSE_FILE" + fi + else + # Update existing APP_VERSION + sed -i.bak "s/APP_VERSION=.*/APP_VERSION=$NEW_VERSION/" "$DOCKER_COMPOSE_FILE" + echo "Updated APP_VERSION in $DOCKER_COMPOSE_FILE" + fi rm -f "$DOCKER_COMPOSE_FILE.bak" - echo "Updated version in $DOCKER_COMPOSE_FILE" echo "Version update complete! New version: $NEW_VERSION" echo "Remember to rebuild and restart the application for changes to take effect."