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

Using squashed commits for releases results in lerna publish listing all packages #1345

Closed
penx opened this issue Mar 22, 2018 · 3 comments
Closed

Comments

@penx
Copy link

penx commented Mar 22, 2018

Our Workflow

  • Developers that are able to propose a release do not have push access to master, all changes go via a pull request on GitHub.
  • Pull requests are set to squash commit to master by default.
  • A developer runs lerna publish --skip-npm on a branch of master and opens a pull request with the version increment.
  • When merged, the default commit message added by GitHub is v1.0.0 (#101) which is the Lerna generated version number followed by the GitHub pull request ID.

Expected Behavior

After following the workflow above, I would expect lerna updated to list no new changes on master immediately after a release.

Current Behavior

All packages are listed as containing changes, I assume because Lerna is looking for a commit message of v1.0.0 for a release, and does not match v1.0.0 (#101).

Possible Solution

When looking for published versions in commit messages, match an optional pull request ID following the version number (e.g. v1.0.0 (#101)) with a regex.

Steps to Reproduce (for bugs)

Our release process is here.

This is partially scripted here.

Executable Version
lerna --version 2.9.0
npm --version 5.6.0
yarn --version 1.5.1
node --version v8.9.4
@evocateur
Copy link
Member

You're deleting the tag, so lerna has literally no idea what the diff from the "last release" was. (Squashing would mangle the tag anyway)

Why not wait until the PR is merged to publish? I don't understand encumbering the developer with lerna publish --skip-npm. If you're using --conventional-commits, the process is quite automated. I don't recommend publishing from feature branches at all.

@penx
Copy link
Author

penx commented Mar 22, 2018

Why not wait until the PR is merged to publish?

We're doing this - we're publishing from master after merge, we delete the tag that's created by Lerna but this is created later with the same name by GitHub via the GitHub releases interface.

However you've made me realise that the issue is that I didn't have all tags locally when I was running lerna updated so I think that's the main issue, I can add a step to our publish script to pull down all tags first. Sorry I had thought it was using the commit message rather than the tag name.

Thanks for your help 🙂

penx added a commit to govuk-react/govuk-react that referenced this issue Mar 22, 2018
lerna uses tags to determine what has changed, we need to make sure we have all tags locally

see lerna/lerna#1345
@penx penx closed this as completed Mar 22, 2018
penx added a commit to govuk-react/govuk-react that referenced this issue Mar 23, 2018
lerna uses tags to determine what has changed, we need to make sure we have all tags locally

see lerna/lerna#1345
penx added a commit to govuk-react/govuk-react that referenced this issue Apr 17, 2018
Fixes #175 (hopefully)

Updates to a devDependency for a package causes `lerna publish` to republish that package. This has a knock on effect throughout our repo meaning a single change to one component can result in every component being republished. We don't want this to happen so are including most devDependencies at the project root (where we expect these dependencies are only used when using the package as part of a monorepo).

Exceptions are where a component has specific peerDependencies and we want to also represent that in the devDependencies.

Related: 

lerna/lerna#1269
lerna/lerna#1345
import-js/eslint-plugin-import#935
@lock
Copy link

lock bot commented Dec 27, 2018

This thread has been automatically locked because there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Dec 27, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants