Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

Attach tags to the "release" commit that modifies the package.jsons #402

Closed
fmal opened this issue Jul 13, 2021 · 12 comments
Closed

Attach tags to the "release" commit that modifies the package.jsons #402

fmal opened this issue Jul 13, 2021 · 12 comments
Assignees
Labels
breaking change enhancement New feature or request
Milestone

Comments

@fmal
Copy link
Contributor

fmal commented Jul 13, 2021

This is a follow-up issue after discussion in #292 (comment).

Currently monodeploy adds the release tags on the commit with the actual feature change / bug fix. In some cases (such as conventional changelog config that uses patch as a default strategy for other commit types) it's more desirable to have tags on the "release" commit that modifies the package.jsons.

This is also what lerna seems to be doing: lerna/lerna@4582c47

@noahnu
Copy link
Contributor

noahnu commented Jul 15, 2021

We can definitely add this, however to entertain an alternative (we can do either, or both):

What if we skipped commits which contained "[skip ci]" in the commit message? This could also be customized via some sort of commit ignore pattern, similar to the changesetIgnorePatterns config option.

@fmal
Copy link
Contributor Author

fmal commented Jul 15, 2021

@noahnu that's a great idea to have a way to skip certain commits when calculating the version strategy, i.e. have a pattern to ignore commits starting with chore: release or containing [skip ci]. It would definitely solve my case. It would make sense for me to move the release tags to the commit modifying the versions, but as long as there is some option to ignore certain commits when calculating the release strategy, that's even more flexible 😄

@noahnu
Copy link
Contributor

noahnu commented Jul 26, 2021

@fmal The latest version of monodeploy should help. In your config file:

commitIgnorePatterns: ['\\[skip ci\\]'],

Docs: https://tophat.github.io/monodeploy/configuration/#schema-option-commitIgnorePatterns (due to limitations with the ajv schema validation, the config option only accepts strings not regexp objects)

@markandrus
Copy link

I have a Slack integration which posts the new packages (well, git tags) which were released. It is sometimes confusing to follow the git tag into GitHub and see that the package.json shows a different version number. So I would also be interested in this feature 👍

@noahnu
Copy link
Contributor

noahnu commented Nov 22, 2021

This should be fairly trivial to do. We'd just move this down to L39:

I wonder if this should become the default behaviour 🤔 . To prevent a breaking change for the moment, we can add some "releaseStrategy" / "tagStrategy" option

@markandrus
Copy link

@noahnu that sounds reasonable! But I need to look at what gitPushTags does to fully understand the suggestion.

This does remind me, though: I am currently disabling monodeploy from automatically pushing. Instead, I iterate through the changeset and push tags myself, one-by-one, before pushing the release commit. This is because I have a GitHub integration that responds to new git tag events, and GitHub will not issue a webhook if more than 3 tags are pushed at a time. This feels like a separate issue, but the method name gitPushTags reminded me of it.

@noahnu
Copy link
Contributor

noahnu commented Nov 22, 2021

Would something like #415 help at all?

@markandrus
Copy link

@noahnu I suppose a "fixed" mode could solve this case, since everything gets bumped together, but I think independent mode makes more sense for my projects in the long run. I believe it should minimize unnecessary updates.


BTW, I took a look at commitPublishChanges and I believe that we'd need to

  • Split commitPublishChanges into two steps, commitChanges and then publishChanges, and update the call here.
  • As part of this, we'd execute the gitPushTags later, as you mentioned.
  • Move the call to createReleaseGitTags further down the file, right after commitChanges.

This should result in

  1. Commit
  2. Tag
  3. Publish

Does my proposal make sense? Allowing to configure this behavior in a clean way may be tricky.

@noahnu
Copy link
Contributor

noahnu commented Nov 28, 2021

Yes that makes sense.

To support configuration options, we could have createReleaseGitTags tag the previous commit if necessary. Though I'm starting to think we don't need to support configuration options here. We can make this the new behaviour. It'll be a breaking change, and we can batch it with some of the other breaking changes I had in mind.

@noahnu noahnu added this to the v3.0.0 milestone Nov 28, 2021
@noahnu noahnu added the good first issue Good for newcomers label Dec 6, 2021
@noahnu noahnu self-assigned this Dec 18, 2021
noahnu added a commit that referenced this issue Dec 18, 2021
BREAKING CHANGE: Monodeploy no longer tags the commit containing the code changes, but rather tags the later commit which contains the package.json changes and other publish artifacts. This is more inline with how Lerna operates and means the tag will match the version in the package.json, as well as the changelog files. If there is interest in adding back the old behaviour behind a configuration option, please open a GitHub issue.
@noahnu
Copy link
Contributor

noahnu commented Dec 18, 2021

This will be out in monodeploy v3 which I'm working on: #452

@noahnu noahnu removed the good first issue Good for newcomers label Dec 18, 2021
noahnu pushed a commit that referenced this issue Dec 18, 2021
BREAKING CHANGE: Monodeploy no longer tags the commit containing the code changes, but rather tags the later commit which contains the package.json changes and other publish artifacts. This is more inline with how Lerna operates and means the tag will match the version in the package.json, as well as the changelog files. If there is interest in adding back the old behaviour behind a configuration option, please open a GitHub issue.
@markandrus
Copy link

Awesome! 🎉

@noahnu
Copy link
Contributor

noahnu commented Jan 2, 2022

Fixed in pre-release: https://github.com/tophat/monodeploy/releases/tag/monodeploy%403.0.0-rc.1 (wouldn't recommend using the pre-release though, will do a proper release as I wrap up some other changes)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
breaking change enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants