diff --git a/lerna-publish.sh b/lerna-publish.sh index 35271762c8709..f610139cbf630 100755 --- a/lerna-publish.sh +++ b/lerna-publish.sh @@ -3,17 +3,41 @@ set -e . .gh-token -echo "Running yarn install..." -yarn install - -if [[ -n $(git status --porcelain) ]]; then - echo "Error: the git working tree is not clean after yarn install. Please review the changes and fix it or commit." - git status - exit 1 -fi - BUMP=$1 if [ "x$BUMP" == "x" ]; then BUMP=patch fi -yarn lerna version --create-release=github --conventional-commits --force-publish --exact $BUMP + +echo "Step 1: bumping versions (no commit/push)..." +yarn lerna version $BUMP \ + --conventional-commits \ + --force-publish \ + --exact \ + --no-git-tag-version \ + --no-push \ + --yes + +echo "Step 2: doing yarn install check..." +CUBESTORE_SKIP_POST_INSTALL=true yarn install + +echo "Step 3: checking git status..." +if git status --porcelain | grep -q '^ M yarn.lock'; then + echo "Error: yarn.lock is not clean after version bump and yarn install. Please review the changes and fix it or commit." + echo "If you see any new entries in yarn.lock with @cubejs-*/* packages - probably not all packages versions were updated." + GIT_PAGER=cat git diff yarn.lock + + echo "Step 4: cleaning up temporary version bump..." + git restore . + + exit 1 +fi + +echo "Step 4: cleaning up temporary version bump..." +git restore . + +echo "Step 5: commit, tag and push version..." +yarn lerna version $BUMP \ + --conventional-commits \ + --force-publish \ + --exact \ + --create-release=github \