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

Bumping wrong version in pyproject.toml #238

Open
alac88 opened this issue Oct 20, 2023 · 6 comments
Open

Bumping wrong version in pyproject.toml #238

alac88 opened this issue Oct 20, 2023 · 6 comments

Comments

@alac88
Copy link

alac88 commented Oct 20, 2023

Hi,
I have the following configuration to automate changelog generation and release:

name: Release
on:
   push:
      branches:
         - main
jobs:
   changelog:
      runs-on: ubuntu-latest
      steps:
         - uses: actions/checkout@v3 # Checkout our working repository
         - name: Conventional Changelog Action # This action will look for conventional commits
           id: changelog
           uses: TriPSs/conventional-changelog-action@v3
           with:
              github-token: ${{ secrets.github_token }}
              version-file: "./package.json, ./pyproject.toml"

         - name: Create Release # This action will create the actual release
           uses: actions/create-release@v1
           if: ${{ steps.changelog.outputs.skipped == 'false' }}
           env:
              GITHUB_TOKEN: ${{ secrets.github_token }}
           with:
              tag_name: ${{ steps.changelog.outputs.tag }}
              release_name: ${{ steps.changelog.outputs.tag }}
              body: ${{ steps.changelog.outputs.clean_changelog }}

By specifying my pyproject.toml in the version files and even though a version is already specified in the first section, it does bump the version but on the very first line of the file like so:

version = "0.1.0"

[tool.poetry]
name = "My project"
version = "0.4.1"
[...]

However I would like it to bump the version in the first section instead:

[tool.poetry]
name = "My project"
version = "0.5.0"
[...]

Is there any way to only bump the targeted version?
Cheers

@TriPSs
Copy link
Owner

TriPSs commented Oct 20, 2023

Interesting, if you only put ./pyproject.toml inside version-file does it than work as expect?

@alac88
Copy link
Author

alac88 commented Oct 23, 2023

Nope, same behavior even though I only put ./pyproject.toml

@technovangelist
Copy link

You added version-file, but you need to set version-path as well. By default it uses version, but it looks like your version is under tool.poetry. so set your version-path to tool.poetry.version.

@alac88
Copy link
Author

alac88 commented Oct 31, 2023

Works like a charm for single version files, thank you. However, how would you specify different paths as two different version files are used here (package.json-> version and pyproject.toml-> tool.poetry.version)?

@TriPSs
Copy link
Owner

TriPSs commented Jan 11, 2024

We either:

  1. Have to support comma separated paths same as for version-file
  2. Change the syntax for version-file to support defining the path in it (eg. version-file: package.json=sub.version

@izyuumi
Copy link

izyuumi commented Mar 6, 2024

Could this be implemented in the next version? I am having the same issue.

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

No branches or pull requests

4 participants