From fdf659d1ea9a1067d2fa3c734e02a058e22a1ef0 Mon Sep 17 00:00:00 2001 From: colin Date: Thu, 3 Jul 2025 13:41:26 -0400 Subject: [PATCH] Update version management system and bump version to 0.1.2 --- README.md | 13 ++++++++----- VERSION | 2 +- docker-compose.yml | 1 + version_history.log | 2 ++ versionbump.sh | 32 +++++++++++++++++++++----------- 5 files changed, 33 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 4407196..8ea7e62 100644 --- a/README.md +++ b/README.md @@ -85,9 +85,10 @@ The application provides a RESTful API for managing transactions. See the API do The application uses semantic versioning (X.Y.Z) with the following components: -- The `VERSION` file is the single source of truth for the application version +- The `VERSION` file at the root of the repository is the single source of truth for the application version +- The web UI and application automatically read the version from this file - Version changes are managed using the `versionbump.sh` script -- A pre-commit hook ensures version consistency across files +- A version history log is maintained in `version_history.log` ### Version Bump Script @@ -114,10 +115,12 @@ The `versionbump.sh` script provides the following commands: The version is maintained in: - `VERSION` file (source of truth) -- Docker Compose environment variables -- Application log messages +- Docker Compose environment variables (APP_VERSION) -The pre-commit hook runs `tests/test_version.py` to verify consistency before allowing commits. +The application reads the version from: +1. The APP_VERSION environment variable if set +2. The VERSION file in the current directory +3. The VERSION file at the root of the repository ## Code Quality and Security diff --git a/VERSION b/VERSION index 6e8bf73..d917d3e 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.1.0 +0.1.2 diff --git a/docker-compose.yml b/docker-compose.yml index e18e08c..fe29ad7 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.2 depends_on: db: condition: service_healthy diff --git a/version_history.log b/version_history.log index e69de29..292d6ea 100644 --- a/version_history.log +++ b/version_history.log @@ -0,0 +1,2 @@ +Thu Jul 3 13:33:04 EDT 2025: Version changed from 0.1.0 to 0.1.1 +Thu Jul 3 13:40:53 EDT 2025: Version changed from 0.1.1 to 0.1.2 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."