qbit_manage/scripts/pre-commit/increase_version.sh
bobokun 8478409027
4.2.1 (#768)
* 4.2.1-develop1

* Adds #747

* Fixes #764

* Replaced pre-commit hooks flake8, black, pyupgrade, etc. with ruff for linting and formatting.

* Bump ruff from 0.9.10 to 0.10.0 (#767)

Bumps [ruff](https://github.com/astral-sh/ruff) from 0.9.10 to 0.10.0.
- [Release notes](https://github.com/astral-sh/ruff/releases)
- [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md)
- [Commits](https://github.com/astral-sh/ruff/compare/0.9.10...0.10.0)

---
updated-dependencies:
- dependency-name: ruff
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* 4.2.1

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-16 19:07:25 -04:00

40 lines
1.3 KiB
Bash
Executable file

#!/usr/bin/env bash
# Check if there are any changes staged for commit
if [[ -z $(git diff --cached --name-only) ]]; then
echo "There are no changes staged for commit. Skipping version update."
exit 0
fi
# Check if the VERSION file is staged for modification
if git diff --cached --name-only | grep -q "VERSION"; then
echo "The VERSION file is already modified. Skipping version update."
exit 0
elif git diff --name-only | grep -q "VERSION"; then
echo "The VERSION file has unstaged changes. Please stage them before committing."
exit 0
fi
# Read the current version from the VERSION file
current_version=$(<VERSION)
echo "Current version: $current_version"
# Check if "develop" is not present in the version string
if [[ $current_version != *"develop"* ]]; then
echo "The word 'develop' is not present in the version string."
exit 0
fi
# Extract the version number after "develop"
version_number=$(echo "$current_version" | sed -n 's/.*develop\([0-9]*\).*/\1/p')
# Increment the version number
new_version_number=$((version_number + 1))
# Replace the old version number with the new one
new_version=$(echo "$current_version" | sed "s/develop$version_number/develop$new_version_number/")
# Update the VERSION file
sed -i "s/$current_version/$new_version/" VERSION
echo "Version updated to: $new_version"