Markus
Markus

Reputation: 4689

How to avoid "version bump only" releases in fixed mode?

I am using Lerna-Lite for publishing new releases, where my software is a fixed/locked one. I am applying Conventional Commits.

When I run lerna version (or publish), every time a new version is being created - also for cases where my Git commit does not intend to so regrading Conventional Commits (the Git commit message refers neither patch, minor or major).

This is kind of intended Lerna behavior, see https://github.com/lerna/lerna/issues/2444

How to avoid such releases?

Upvotes: 0

Views: 108

Answers (1)

Markus
Markus

Reputation: 4689

Run Lerna-Lite version --dry-run for detecting, if the current release would be a "version bump only".

npx -p conventional-changelog-conventionalcommits@7 -p @lerna-lite/cli@3 -p @lerna-lite/version@3 \
  lerna version --yes  --dry-run

runPublishing=false
if git diff --quiet --exit-code CHANGELOG.md; then
  echo "No changes to CHANGELOG.md"
else
  if git diff -U0 CHANGELOG.md | grep -q "Version bump only"; then
    echo "Version bump only"
  else
    runPublishing=true
  fi
fi

if [ "$runPublishing" != true ]; then
  echo \$runPublishing: "$runPublishing"
  exit 0
fi

git checkout -- .
npx -p conventional-changelog-conventionalcommits@7 -p @lerna-lite/cli@3 -p @lerna-lite/publish@3 \
  lerna publish --yes

Upvotes: 0

Related Questions