Skip to content
Snippets Groups Projects
Commit 64b624a4 authored by Gaëtan Montury's avatar Gaëtan Montury Committed by Pierre Smeyers
Browse files

fix(bump-my-version): improve bump-my-version config verification (solves #106)

parent d934e5a9
No related branches found
No related tags found
No related merge requests found
......@@ -873,12 +873,19 @@ variables:
# create cfg in case it doesn't exist - will be updated by bumpversion
if [[ ! "$py_cur_version" && ! -f ".bumpversion.cfg" && ! -f ".bumpversion.toml" && ! -f "pyproject.toml" && ! -f "setup.cfg" ]]
then
log_error "Current version not defined and not version file found, set initial version at least in .bumpversion.toml or pyproject.toml"
log_warn "Current version not defined and no version file found: please set initial version in .bumpversion.toml, .bumpversion.cfg, setup.cfg or pyproject.toml ([tool.bumpversion] section)"
fi
bump-my-version bump ${TRACE+--verbose} --current-version "${py_cur_version:-${PYTHON_RELEASE_START_VERSION:-0.0.0}}" --new-version "$py_next_version" --commit ${PYTHON_RELEASE_COMMIT_MESSAGE:+--message "$PYTHON_RELEASE_COMMIT_MESSAGE"} --tag --tag-name "{new_version}" "$py_release_part"
elif [[ -f ".bumpversion.cfg" ]]
elif [[ -f ".bumpversion.cfg" || -f ".bumpversion.toml" || -f "pyproject.toml" || -f "setup.cfg" ]]
then
# current version shall be set in .bumpversion.cfg
if [[ ! -f ".bumpversion.cfg" && ! -f ".bumpversion.toml" && ! -f "setup.cfg" ]] # pyproject.toml case
then
if ! grep -q '^[[:space:]]*\[tool\.bumpversion\]' "pyproject.toml"
then
log_warn "Current version not defined and no version file found: please set initial version in pyproject.toml ([tool.bumpversion] section)"
fi
fi
# current version shall be set in bump-my-version config file
py_release_part="$PYTHON_RELEASE_NEXT"
log_info "[bump-my-version bump] increase \\e[1;94m${py_release_part}\\e[0m"
bump-my-version bump ${TRACE+--verbose} --commit ${PYTHON_RELEASE_COMMIT_MESSAGE:+--message "$PYTHON_RELEASE_COMMIT_MESSAGE"} --tag --tag-name "{new_version}" "$py_release_part"
......@@ -890,7 +897,7 @@ variables:
log_info "[bump-my-version] increase \\e[1;94m${py_release_part}\\e[0m (from current \\e[1;94m${py_cur_version}\\e[0m)"
bump-my-version bump ${TRACE+--verbose} --current-version "$py_cur_version" --commit ${PYTHON_RELEASE_COMMIT_MESSAGE:+--message "$PYTHON_RELEASE_COMMIT_MESSAGE"} --tag --tag-name "{new_version}" "$py_release_part" setup.py
else
log_error "--- setup.py or .bumpversion.cfg file required to retrieve current version: cannot perform release"
log_error "--- setup.py, .bumpversion.toml, pyproject.toml, .bumpversion.cfg(deprecated) or setup.cfg(deprecated) file required to retrieve current version: cannot perform release"
exit 1
fi
fi
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment