Skip to content

Commit a94ac16

Browse files
committed
chore(scripts): fix release script
1 parent 30079ac commit a94ac16

3 files changed

Lines changed: 18 additions & 1 deletion

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ node_modules
33
trace.log
44
trace_*
55
coverage
6+
.tmp

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
"cover": "istanbul cover _mocha $(find ./lib -name \"*.spec.js\" -not -path \"./node_modules/*\"); open coverage/lcov-report/index.html",
3232
"changelog": "conventional-changelog -p angular -o CHANGELOG.md -r 500",
3333
"semantic-release": "semantic-release pre && npm publish && semantic-release post",
34+
"semantic-release-pre": "semantic-release pre",
35+
"semantic-release-post": "semantic-release post",
3436
"install": "npm i v8-profiler --build-from-source || exit 0"
3537
},
3638
"repository": {

scripts/semantic-release.sh

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,19 @@ elif [ "$PROJECT_REPONAME" != "$RELEASE_REPONAME" ]; then
1010
elif [ "$CURRENT_BRANCH" != "$RELEASE_BRANCH" ]]; then
1111
echo "Branch is not $RELEASE_BRANCH. Release skipped"
1212
else
13-
CI=true npm run semantic-release
13+
mkdir -p .tmp
14+
tmpfile=semantic-release-$(date +'%Y%m%d%H%M%S')
15+
set +e
16+
CI=true npm run semantic-release-pre 2> .tmp/$tmpfile
17+
if [ "$?" -ne "0" ]; then
18+
grep -oE 'ENOCHANGE (.+)$' .tmp/$tmpfile
19+
if [ "$?" -ne "0" ]; then
20+
echo "Semantic release failed. Reason:"
21+
cat .tmp/$tmpfile
22+
exit 1
23+
fi
24+
fi
25+
set -e
26+
npm publish
27+
CI=true npm run semantic-release-post
1428
fi

0 commit comments

Comments
 (0)