TriPSs / conventional-changelog-action

Github Action that generates a changelog with the Conventional Changelog CLI
MIT License
290 stars 103 forks source link

Bumping wrong version in pyproject.toml #238

Open alac88 opened 10 months ago

alac88 commented 10 months ago

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 commented 10 months ago

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

alac88 commented 10 months ago

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

technovangelist commented 10 months ago

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 commented 10 months ago

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 commented 7 months ago

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 commented 6 months ago

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