versionDatabaseCommit.sh
1 #!/bin/bash 2 set -euo pipefail 3 4 if [ -z "${1:-}" ] 5 then 6 echo "Error: bump type is required. Usage: $0 [minor|major]" 7 exit 1 8 fi 9 10 BUMP_TYPE=$1 11 12 if [[ "$BUMP_TYPE" != "minor" && "$BUMP_TYPE" != "major" ]]; then 13 echo "Error: bump type must be 'minor' or 'major'" 14 exit 1 15 fi 16 17 # Bump the version in hosting/couchdb/VERSION 18 node ./bumpDatabaseVersion.js "$BUMP_TYPE" 19 20 NEW_VERSION=$(cat ../hosting/couchdb/VERSION | tr -d '[:space:]') 21 22 # Update all hardcoded references to the database image version 23 sed -i.bak "s|budibase/database:[0-9]*\.[0-9]*\.[0-9]*|budibase/database:${NEW_VERSION}|g" \ 24 ../package.json \ 25 ../hosting/docker-compose.yaml \ 26 ../hosting/docker-compose.dev.yaml \ 27 ../hosting/single/Dockerfile \ 28 ../hosting/tests/Dockerfile \ 29 ../globalSetup.ts 30 31 # Update the Helm chart value 32 sed -i.bak "s|tag: \"[0-9]*\.[0-9]*\.[0-9]*\"|tag: \"${NEW_VERSION}\"|g" \ 33 ../charts/budibase/values.yaml 34 35 # Clean up .bak files 36 find .. -name "*.bak" -delete 37 38 git add ../hosting/couchdb/VERSION \ 39 ../package.json \ 40 ../hosting/docker-compose.yaml \ 41 ../hosting/docker-compose.dev.yaml \ 42 ../hosting/single/Dockerfile \ 43 ../hosting/tests/Dockerfile \ 44 ../globalSetup.ts \ 45 ../charts/budibase/values.yaml 46 47 git commit -m "Bump database version to $NEW_VERSION" 48 git tag "database-$NEW_VERSION" 49 git push 50 git push --tags