Update version management system and bump version to 0.1.2
ci/woodpecker/push/woodpecker Pipeline was successful Details

This commit is contained in:
colin 2025-07-03 13:41:26 -04:00
parent 52536db6d9
commit fdf659d1ea
5 changed files with 33 additions and 17 deletions

View File

@ -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

View File

@ -1 +1 @@
0.1.0
0.1.2

View File

@ -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

View File

@ -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

View File

@ -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."