Skip to content

Commit

Permalink
Migrate to bump-my-version
Browse files Browse the repository at this point in the history
  • Loading branch information
mdellweg committed Nov 15, 2024
1 parent 4ba515c commit dd65f8e
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 11 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ jobs:
- name: "Verify bump version config"
run: |
bump2version --dry-run --list release
bump-my-version bump --dry-run release
bump-my-version show-bump
# run black separately from flake8 to get a diff
- name: "Run black"
Expand Down
2 changes: 1 addition & 1 deletion templates/github/.ci/assets/release_requirements.txt.j2
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
bump2version
bump-my-version
gitpython
towncrier
6 changes: 3 additions & 3 deletions templates/github/.github/workflows/create-branch.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:

{{ setup_python() | indent(6) }}

{{ install_python_deps(["bump2version", "packaging", "-r", "plugin_template/requirements.txt"]) | indent(6) }}
{{ install_python_deps(["bump-my-version", "packaging", "-r", "plugin_template/requirements.txt"]) | indent(6) }}

{{ set_secrets(path=plugin_name) | indent(6) }}

Expand All @@ -36,7 +36,7 @@ jobs:
run: |
# Just to be sure...
git checkout {{ plugin_default_branch }}
NEW_BRANCH="$(bump2version --dry-run --list release | sed -Ene 's/^new_version=([[:digit:]]+\.[[:digit:]]+)\..*$/\1/p')"
NEW_BRANCH="$(bump-my-version show new_version --increment release | sed -Ene 's/^([[:digit:]]+\.[[:digit:]]+)\.[[:digit:]]+$/\1/p')"
if [ -z "$NEW_BRANCH" ]
then
echo Could not determine the new branch name.
Expand All @@ -52,7 +52,7 @@ jobs:
- name: Bump version on {{ plugin_default_branch }} branch
working-directory: {{ plugin_name }}
run: |
bump2version --no-commit minor
bump-my-version bump --no-commit minor

- name: Remove entries from CHANGES directory
working-directory: {{ plugin_name }}
Expand Down
3 changes: 2 additions & 1 deletion templates/github/.github/workflows/lint.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ jobs:

- name: "Verify bump version config"
run: |
bump2version --dry-run --list release
bump-my-version bump --dry-run release
bump-my-version show-bump
{%- if black %}

# run black separately from flake8 to get a diff
Expand Down
2 changes: 1 addition & 1 deletion templates/github/.github/workflows/release.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:

{{ setup_python() | indent(6) }}

{{ install_python_deps(["bump2version", "towncrier"]) | indent(6) }}
{{ install_python_deps(["bump-my-version", "towncrier"]) | indent(6) }}

{{ configure_git() | indent(6) }}

Expand Down
7 changes: 4 additions & 3 deletions templates/github/.github/workflows/scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ then
exit 1
fi

NEW_VERSION="$(bump2version --dry-run --list release | sed -ne 's/^new_version=//p')"
# The tail is a necessary workaround to remove the warning from the output.
NEW_VERSION="$(bump-my-version show new_version --increment release | tail -n -1)"
echo "Release ${NEW_VERSION}"

if ! [[ "${NEW_VERSION}" == "${BRANCH}"* ]]
Expand All @@ -20,7 +21,7 @@ then
fi

towncrier build --yes --version "${NEW_VERSION}"
bump2version release --commit --message "Release {new_version}" --tag --tag-name "{new_version}" --tag-message "Release {new_version}" --allow-dirty
bump2version patch --commit
bump-my-version bump release --commit --message "Release {new_version}" --tag --tag-name "{new_version}" --tag-message "Release {new_version}" --allow-dirty
bump-my-version bump patch --commit

git push origin "${BRANCH}" "${NEW_VERSION}"
2 changes: 1 addition & 1 deletion templates/github/lint_requirements.txt.j2
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{% if black -%}
black==24.3.0
{% endif -%}
bump2version
bump-my-version
check-manifest
flake8
{% if black -%}
Expand Down

0 comments on commit dd65f8e

Please sign in to comment.