qiwi / multi-semantic-release

Proof of concept that wraps semantic-release to work with monorepos.
BSD Zero Clause License
86 stars 34 forks source link

bug: `tagFormat` option is omitted from config (?) #72

Closed antongolub closed 2 years ago

antongolub commented 2 years ago

Hey, @antongolub 👋

It will be a couple of days before I can do any thorough testing, but from just a single quick and dirty test, it does look like using v${version}+${name} does sort the tags correctly. Have only done prereleases, so can't confirm if it fixes the issue with release ordering, but I'd imagine it does given tags are now sorting correctly.

FYI. I was attempting to set tagFormat as an option from the root package.json, and noticed it was being ignored, instead it's only picked up as a CLI arg, this may be expected, but for me it was contrary to expectations.

Does not work

root/
    package.json
        "release": {
            "tagFormat": "v${version}+${name}",
            ...
        }

Works

multi-semantic-release --tag-format='v${version}+${name}'

Originally posted by @GeeWizWow in https://github.com/qiwi/multi-semantic-release/issues/71#issuecomment-1137061875

GeeWizWow commented 2 years ago

So looking at the code in a bit more detail, this would never have worked, msr explicitly overwrites the tagFormat with the version retrieved from args (flags in this context).

https://github.com/qiwi/multi-semantic-release/blob/4b20da7297a2b7d5644e780090db656898c3e32c/lib/multiSemanticRelease.js#L195

The same goes for all the other options for msr such as deps.bump, deps.release etc...


I would like to use this feature to create a sharable config for msr that can be re-used across repos in my org. If this was to become a feature, what do you think of the following options?

"release": {
    "plugins": [...],
    "branches": [...],
    "deps": {
        "bump": "satisfy",
    }
}

Unless care is taken to omit msr specific options, this may lead to un-recognized options being passed down to semrel where undefined behaviour could occur. 👎

"release": {
    "plugins": [...],
    "branches": [...],
    "multi-release": {
        "tagFormat": "...",
        "deps": {
              "bump": "override",
         }
    }
}

Easier to omit when passing options to semrel, but still feels like mixing concerns 🤔

"release": {
    "plugins": [...],
    "branches": [...],
},
"multi-release": {
    "tagFormat": "...",
    "deps": {
          "bump": "override",
    }
}

The cleanest approach imo, but would have to add support for config parsing, as well as extends keyword to be useful, so additional complexity.

Thoughts @antongolub ?

GeeWizWow commented 2 years ago

For some additional context, semrel use cosmiconfig to help retrieve and parse config from a variety of different files/ sources.

https://github.com/semantic-release/semantic-release/blob/ab45ab1f8d0d0f728fb026a92ec191bcc88f51f1/lib/get-config.js#L15

antongolub commented 2 years ago

+1, we definitely should add declarative configs for msr.

qiwibot commented 2 years ago

:tada: This issue has been resolved in version 6.5.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: