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

fix(lerna): aggressive patch bump #1163

Open
wants to merge 16 commits into
base: release-v10
Choose a base branch
from

Conversation

SudilHasithaCognite
Copy link
Contributor

@SudilHasithaCognite SudilHasithaCognite commented Oct 7, 2024

Addressing Lerna aggressive versioning

We restrict new npm releases to [release]-tagged commits because lerna is
quite aggressive in its versioning. Changes to any file not ignored by Lerna will
cause a PATCH bump. Markdown files and tests are ignored, but changing anything else,
like a comment in a source file, will trigger a new version,
irrespective of conventional commits.

References

  1. Lerna documentation: https://github.com/lerna/lerna/tree/main/libs/commands/version#--no-git-tag-version

Expected behavior of the change

By using the implemented logic we can control the versioning and releasing of release candidates as below.

  1. To keep versions constant and publish the release candidates package to npm in a release branch
  • feat/fix/chore (xyz): feature/fix/chore keep constant and publish [release]
  1. To increase the version and publish the release candidates package to npm in a release branch (chore will not increase the version since we are using --conventional-commits flag)
  • feat/fix (abc): feature/fix increase version and publish [release] [bump-version]
  1. To trigger and publish a job but not release (no versioning or publishing) in a release branch
  • feat/fix (zqa): feature/fix no versioning or publishing

The effect of new release.yaml to master branch. Master is also add to alloweBranch list in lerna.json to facilitate the npm package releases.

  1. PR merge without [release] won't update the version or publish to npm.
  • feat/fix/chore (abc): feature/fix/chore no version update or publish
  1. PR merge with [release] from release-nx to master, keep constant version, and publish to npm.
  • feat/fix (xyz): feature/fix no version update and publish [release]
  1. PR merge with [release][bump-version] from release-nx to master, patch version update, and publish to npm
  • feat/fix (xyz): feature/fix version update according to patch(minor) [release][bump-version]
  1. PR merge with [release] from release-nx to master with constant version and publish to npm.
  • chore (kgb): constant version as release branch [release]
  • NB: Before merging to master we have to manually remove rc tag from pacakage.json.

Experiments performed are added below. (play 2X or higher)

04_Moving_From_Conventional_Commit_to_Patch.webm
02_New_Release_Branch_Behavior.webm
03_Current_Master_After_Merging_Cannot_Publish.webm
01_Version_Error_Publishing_Main.webm

@SudilHasithaCognite SudilHasithaCognite requested a review from a team October 7, 2024 09:28
@SudilHasithaCognite SudilHasithaCognite added the do-not-merge don't merge this PR until this label is gone. label Oct 8, 2024
Copy link

@EliasBjorne EliasBjorne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Im not too familiar with this setup, but from what I see, it seems like this changes a bit of the release logic. We should then also update the
CONTRIBUTING Readme
so it mirrors these changes. Both regarding to the logic we should have when we remove
--conventional-commits

The logic around bump-verion etc.

I'm not too opinionated on what the best release strategy is as long as it is well documented

.github/workflows/release.yaml Show resolved Hide resolved
.github/workflows/release.yaml Show resolved Hide resolved
@SudilHasithaCognite SudilHasithaCognite removed the do-not-merge don't merge this PR until this label is gone. label Oct 11, 2024
@SudilHasithaCognite
Copy link
Contributor Author

Im not too familiar with this setup, but from what I see, it seems like this changes a bit of the release logic. We should then also update the CONTRIBUTING Readme so it mirrors these changes. Both regarding to the logic we should have when we remove --conventional-commits

The logic around bump-verion etc.

I'm not too opinionated on what the best release strategy is as long as it is well documented

Updated the contributing guidelines.

@SudilHasithaCognite SudilHasithaCognite self-assigned this Oct 25, 2024
Copy link

@EliasBjorne EliasBjorne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should add some details on how we want to work with release branches. In other repos I have worked with, all fixes are merged into master, and then fixes are cherry picked from master to release branches. We should have some documentation on how we want to do this?

CONTRIBUTING.md Show resolved Hide resolved
CONTRIBUTING.md Outdated
fix(graphUtils): circular path detection [release]
```

4. If you want to release a version bumped package from master branch

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure I understand this sentence

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, my wording makes no sense here. This is to release patches and minor version updates to the stable release

```

5. If you want to release a package to npm from master by merging the release branch to it while keeping the major version number in release condidate as it is.
- Create a PR from release-* branch to master

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the usecase for this? I think the most tidy thing is to always push things to master, and then cherry pick fixes from master to release branches. Do we want to do this? @BugGambit

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

Successfully merging this pull request may close these issues.

2 participants