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

Allow version --print outside of release branches #900

Open
jameshounshell opened this issue Apr 24, 2024 · 3 comments · May be fixed by #926
Open

Allow version --print outside of release branches #900

jameshounshell opened this issue Apr 24, 2024 · 3 comments · May be fixed by #926
Labels
confirmed Prevent from becoming stale feature A new feature or a feature request

Comments

@jameshounshell
Copy link

jameshounshell commented Apr 24, 2024

Description

Prior to v8, you could print current or upcoming version from any branch or detached head. This is no longer possible because v8 restricts all commands to only run on configured release branches (default: main).

Use cases

In v7 I found this very useful for testing whether I had a repo setup correctly and I also used it in CI to determine the current version and use that as the tag for a docker image.

Possible implementation

If possible it would be great to allow any operations on any branch/head when the --noop flag is provided and instead just warn the user that the operation is normally only allowed on the configured release branches.

Caveat

I have scoured the github issues and docs for any discourse on this and I realize that this may never be implemented as it is probably against this project's design principles. Thanks in advance for your consideration.

(Relevant: #823)

Current Workaround

For now since I use the python-semantic-release github action, after main builds a new tag is created, this kicks of the docker build and I just use ${{git.ref_name}} to name the image since that's the semver.

@jameshounshell jameshounshell added the feature A new feature or a feature request label Apr 24, 2024
@codejedi365
Copy link
Contributor

@jameshounshell, thank you for your submission.

To clarify, #823 answer was only specific to get a detached head state working with the version as it stood at the time.

I have reviewed the code related to the detached head restriction and configured release branches and some of what you request should be doable. I do think we are enforcing the release branches configuration a bit too early in the startup process and it can be moved later.

I'm a bit more hesitant on the detached head state prevention because we rely on the prerelease token value from the release branches configuration to determine the next version. This cannot be determined from a detached head state. I have considered an automatic resolve from a detached head state but outside of a CI environment this might be less desirable.

So in theory, asking for the current version has no restrictions, asking for the next version is restricted in a detached head state (unless a prerelease token/flag option is provided) and unrestricted if branches don't match and --print is presented (will display a warning). If branches don't match an error will be presented before any version actions are taken (ie --print not provided)

@jameshounshell
Copy link
Author

Current version at least would be amazing. Thank you so much for entertaining this. ❤️

@codejedi365 codejedi365 added confirmed Prevent from becoming stale and removed confirmed Prevent from becoming stale labels Apr 29, 2024
@codejedi365
Copy link
Contributor

codejedi365 commented Apr 29, 2024

Thanks for the response. I don't have an estimated time for resolution yet but likely will be an able to address it over the next month or two, depending on the ease of change. I have a few features and improvements already in work

@codejedi365 codejedi365 added the confirmed Prevent from becoming stale label May 5, 2024
codejedi365 added a commit to codejedi365/python-semantic-release that referenced this issue May 6, 2024
codejedi365 added a commit to codejedi365/python-semantic-release that referenced this issue May 7, 2024
codejedi365 added a commit to codejedi365/python-semantic-release that referenced this issue May 13, 2024
codejedi365 added a commit to codejedi365/python-semantic-release that referenced this issue May 13, 2024
codejedi365 added a commit to codejedi365/python-semantic-release that referenced this issue May 13, 2024
codejedi365 added a commit to codejedi365/python-semantic-release that referenced this issue May 13, 2024
codejedi365 added a commit to codejedi365/python-semantic-release that referenced this issue May 13, 2024
codejedi365 added a commit to codejedi365/python-semantic-release that referenced this issue May 18, 2024
codejedi365 added a commit to codejedi365/python-semantic-release that referenced this issue May 18, 2024
codejedi365 added a commit to codejedi365/python-semantic-release that referenced this issue May 18, 2024
codejedi365 added a commit to codejedi365/python-semantic-release that referenced this issue May 18, 2024
codejedi365 added a commit to codejedi365/python-semantic-release that referenced this issue May 18, 2024
codejedi365 added a commit to codejedi365/python-semantic-release that referenced this issue May 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed Prevent from becoming stale feature A new feature or a feature request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants