Updated the deploy and version bump scripts to use major minor and patch notation.
This commit is contained in:
@@ -3,15 +3,14 @@ set -euo pipefail
|
|||||||
parent_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" || exit ; pwd -P )
|
parent_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" || exit ; pwd -P )
|
||||||
cd "$parent_path" || exit
|
cd "$parent_path" || exit
|
||||||
|
|
||||||
./lint.sh
|
#./lint.sh
|
||||||
|
|
||||||
if [ 1 -eq "$#" ]
|
if [ 1 -eq "$#" ]
|
||||||
then
|
then
|
||||||
./version_bump.sh "$1"
|
./version_bump.sh "$1"
|
||||||
make build-production TAG="$1"
|
|
||||||
else
|
|
||||||
./version_bump.sh
|
|
||||||
make build-production
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
current_version=$(grep -m 1 '^version = ' brewman/pyproject.toml | sed -E 's/version = "([^"]+)"/\1/')
|
||||||
|
make build-production TAG="$current_version"
|
||||||
cd "$parent_path/ansible" || exit
|
cd "$parent_path/ansible" || exit
|
||||||
ansible-playbook --inventory hosts playbook.yml
|
ansible-playbook --inventory=hosts playbook.yml
|
||||||
|
|||||||
+32
-9
@@ -1,23 +1,46 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -e
|
set -euo pipefail
|
||||||
|
|
||||||
parent_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" || exit ; pwd -P )
|
parent_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" || exit ; pwd -P )
|
||||||
cd "$parent_path" || exit
|
cd "$parent_path" || exit
|
||||||
|
|
||||||
if [ 1 -eq "$#" ]
|
if [ 1 -eq "$#" ]
|
||||||
then
|
then
|
||||||
echo "Version bump to $1"
|
current_version=$(grep -m 1 '^version = ' brewman/pyproject.toml | sed -E 's/version = "([^"]+)"/\1/')
|
||||||
sed --in-place --regexp-extended 's/"([0-9]*.[0-9].[0-9])"/"'"$1"'"/g' brewman/brewman/__version__.py
|
IFS='.' read -r major minor patch <<< "$current_version"
|
||||||
|
|
||||||
|
if [ "$1" == "major" ]; then
|
||||||
|
major=$((major + 1))
|
||||||
|
minor=0
|
||||||
|
patch=0
|
||||||
|
new_version="${major}.${minor}.${patch}"
|
||||||
|
elif [ "$1" == "minor" ]; then
|
||||||
|
minor=$((minor + 1))
|
||||||
|
patch=0
|
||||||
|
new_version="${major}.${minor}.${patch}"
|
||||||
|
elif [ "$1" == "patch" ]; then
|
||||||
|
patch=$((patch + 1))
|
||||||
|
new_version="${major}.${minor}.${patch}"
|
||||||
|
elif [[ "$1" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
||||||
|
new_version="$1"
|
||||||
|
else
|
||||||
|
echo "Invalid argument: must be 'major', 'minor', 'patch', or a specific version (e.g. 1.2.3)"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Version bump from $current_version to $new_version"
|
||||||
|
sed --in-place --regexp-extended 's/"([0-9]{1,2}.[0-9]+.[0-9]+)"/"'"$new_version"'"/g' brewman/brewman/__version__.py
|
||||||
git add brewman/brewman/__version__.py
|
git add brewman/brewman/__version__.py
|
||||||
sed --in-place --regexp-extended 's/version = "([0-9]*.[0-9].[0-9])"/version = "'"$1"'"/g' brewman/pyproject.toml
|
sed --in-place --regexp-extended 's/version = "([0-9]{1,2}.[0-9]+.[0-9]+)"/version = "'"$new_version"'"/g' brewman/pyproject.toml
|
||||||
git add brewman/pyproject.toml
|
git add brewman/pyproject.toml
|
||||||
sed --in-place --regexp-extended 's/version: '\''([0-9]*.[0-9].[0-9])'\''/version: '\'"$1"\''/g' overlord/src/app/app.environment.ts
|
sed --in-place --regexp-extended 's/version: '\''([0-9]*.[0-9]+.[0-9]+)'\''/version: '\'"$new_version"\''/g' overlord/src/app/app.environment.ts
|
||||||
git add overlord/src/app/app.environment.ts
|
git add overlord/src/app/app.environment.ts
|
||||||
sed --in-place --regexp-extended 's/"version": "([0-9]*.[0-9].[0-9])"/"version": "'"$1"'"/g' overlord/package.json
|
sed --in-place --regexp-extended 's/"version": "([0-9]{1,2}.[0-9]+.[0-9]+)"/"version": "'"$new_version"'"/g' overlord/package.json
|
||||||
git add overlord/package.json
|
git add overlord/package.json
|
||||||
git commit -m "Version Bump v$1"
|
git commit -m "Version Bump v$new_version"
|
||||||
git tag "v$1"
|
git tag "v$new_version"
|
||||||
else
|
else
|
||||||
echo "No version bump"
|
echo "No version bump"
|
||||||
|
echo "Usage: $0 <major|minor|patch|version_string>"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
git push --tags
|
git push --tags
|
||||||
|
|||||||
Reference in New Issue
Block a user