Skip to content

Commit 717e597

Browse files
KSDaemonmarianore-muttdata
authored andcommitted
chore(dev-tools): Add safeguard to lerna publish script (cube-js#9593)
1 parent 1577223 commit 717e597

File tree

1 file changed

+34
-10
lines changed

1 file changed

+34
-10
lines changed

lerna-publish.sh

Lines changed: 34 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,41 @@ set -e
33

44
. .gh-token
55

6-
echo "Running yarn install..."
7-
yarn install
8-
9-
if [[ -n $(git status --porcelain) ]]; then
10-
echo "Error: the git working tree is not clean after yarn install. Please review the changes and fix it or commit."
11-
git status
12-
exit 1
13-
fi
14-
156
BUMP=$1
167
if [ "x$BUMP" == "x" ]; then
178
BUMP=patch
189
fi
19-
yarn lerna version --create-release=github --conventional-commits --force-publish --exact $BUMP
10+
11+
echo "Step 1: bumping versions (no commit/push)..."
12+
yarn lerna version $BUMP \
13+
--conventional-commits \
14+
--force-publish \
15+
--exact \
16+
--no-git-tag-version \
17+
--no-push \
18+
--yes
19+
20+
echo "Step 2: doing yarn install check..."
21+
CUBESTORE_SKIP_POST_INSTALL=true yarn install
22+
23+
echo "Step 3: checking git status..."
24+
if git status --porcelain | grep -q '^ M yarn.lock'; then
25+
echo "Error: yarn.lock is not clean after version bump and yarn install. Please review the changes and fix it or commit."
26+
echo "If you see any new entries in yarn.lock with @cubejs-*/* packages - probably not all packages versions were updated."
27+
GIT_PAGER=cat git diff yarn.lock
28+
29+
echo "Step 4: cleaning up temporary version bump..."
30+
git restore .
31+
32+
exit 1
33+
fi
34+
35+
echo "Step 4: cleaning up temporary version bump..."
36+
git restore .
37+
38+
echo "Step 5: commit, tag and push version..."
39+
yarn lerna version $BUMP \
40+
--conventional-commits \
41+
--force-publish \
42+
--exact \
43+
--create-release=github \

0 commit comments

Comments
 (0)