Skip to content

Commit d50324e

Browse files
committed
chore: add release script
1 parent 2c5f488 commit d50324e

File tree

2 files changed

+38
-2
lines changed

2 files changed

+38
-2
lines changed

package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@
2323
"start": "cross-env TARGET=es rollup -c -w",
2424
"build": "rollup -c",
2525
"test": "cross-env NODE_ENV=test jest",
26-
"prepub": "npm run test && npm run build",
27-
"pub": "npm publish"
26+
"release": "bash scripts/release.sh"
2827
},
2928
"bugs": {
3029
"url": "https://github.com/vuejs/vue-function-api/issues"

scripts/release.sh

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/bin/bash
2+
set -e
3+
4+
if [[ -z $1 ]]; then
5+
echo "Enter new version: "
6+
read -r VERSION
7+
else
8+
VERSION=$1
9+
fi
10+
11+
read -p "Releasing $VERSION - are you sure? (y/n) " -n 1 -r
12+
echo
13+
if [[ $REPLY =~ ^[Yy]$ ]]; then
14+
echo "Releasing $VERSION ..."
15+
16+
if [[ -z $SKIP_TESTS ]]; then
17+
npm run test
18+
fi
19+
20+
# build
21+
VERSION=$VERSION npm run build
22+
23+
# commit
24+
# git add -A
25+
# git commit -m "build: build $VERSION"
26+
# tag version
27+
npm version "$VERSION" --message "build: release $VERSION"
28+
29+
# publish
30+
git push origin refs/tags/v"$VERSION"
31+
git push
32+
if [[ -z $RELEASE_TAG ]]; then
33+
npm publish
34+
else
35+
npm publish --tag "$RELEASE_TAG"
36+
fi
37+
fi

0 commit comments

Comments
 (0)