Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get current version #15

Closed
kdeldycke opened this issue Jun 5, 2023 · 6 comments · Fixed by #23
Closed

Get current version #15

kdeldycke opened this issue Jun 5, 2023 · 6 comments · Fixed by #23
Assignees
Labels
feature-request New feature or request

Comments

@kdeldycke
Copy link
Collaborator

Thanks @coordt for resurrecting the bumpversion project!

Description

I'd like to have a way for the bump-my-version CLI to tell me which version my project is currently at.

What I Did

I naively supposed the --current-version parameter did that, but that's not the case:

$ bump-my-version --current-version
╭─ Error ──────────────────────────────────────────────────────────────────────────╮
│ Option '--current-version' requires an argument.                                 │
╰──────────────────────────────────────────────────────────────────────────────────╯     

I need this for some of my release automation. Before I switched to bump-my-version, I relied on janky code, like shell one-liner:

$ grep "current_version = " ./.bumpversion.cfg | cut -d ' ' -f 3

And its version integrated in GitHub workflow:

jobs:
  my-job:
    steps:
      - name: Extract version
        id: get_version
        run: |
          echo "new_version=$( grep "current_version = " ./.bumpversion.cfg | cut -d ' ' -f 3 )" >> "$GITHUB_OUTPUT"
      - name: Print version
        run: |
          echo "New version: ${{ steps.get_version.outputs.new_version }}"

But now with the possibility offered by bump-my-version to source its configuration from multiple location (including the pyproject.toml file), its hard to reproduce the internals of bump-my-version.

That's why having a way to fetch the canonical current version by the way of the CLI would improve reliability.

@coordt
Copy link
Member

coordt commented Jun 7, 2023

I've been swamped at work the past few days, but wanted to at least acknowledge you.

This very thing is something I'll be tackling this/next week.

@kdeldycke
Copy link
Collaborator Author

Thanks @coordt for taking the time to answer this. No rush though! bump-my-version is still better than bump2version!

I still have work on my side to integrate it to my workflow. There's also a non-zero chance that I might propose some PR in the future. 🤗

@kdeldycke
Copy link
Collaborator Author

For the record, the original feature request was covered by: c4urself/bump2version#57

@coordt
Copy link
Member

coordt commented Jun 12, 2023

I'm post-poning this until I finish the first part of #16 (which I am almost done with). It will make the interface for showing information easier, I think.

@coordt coordt linked a pull request Jun 21, 2023 that will close this issue
@coordt
Copy link
Member

coordt commented Jun 21, 2023

@kdeldycke Hey, I just created a pull request for this issue. I'm currently modifying the docs, but if you wanted to take a look, I'd appreciate it.

@kdeldycke
Copy link
Collaborator Author

kdeldycke commented Jun 22, 2023

@kdeldycke Hey, I just created a pull request for this issue. I'm currently modifying the docs, but if you wanted to take a look, I'd appreciate it.

OK, playing with your 15-get-current-version branch right now. Will report my observations on #23.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants