Skip to content

Commit 19368c4

Browse files
committed
workflow: add release script.
1 parent 311e17f commit 19368c4

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"build": "node bin/vuepress build docs",
1212
"lint": "eslint --fix --ext .js,.vue bin/ lib/ test/",
1313
"prepublishOnly": "conventional-changelog -p angular -r 2 -i CHANGELOG.md -s",
14+
"release": "/bin/bash scripts/release.sh",
1415
"test": "node test/prepare.js && jest --config test/jest.config.js"
1516
},
1617
"repository": {

scripts/release.sh

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/bin/bash
2+
3+
echo "Select a version to release (input number):"
4+
echo
5+
6+
select VERSION in patch minor major "Specific Version"
7+
do
8+
echo
9+
if [[ $REPLY == 4 ]]; then
10+
read -p "Enter a specific version: " -r VERSION
11+
echo
12+
if [[ -z $REPLY ]]; then
13+
VERSION=$REPLY
14+
fi
15+
fi
16+
17+
read -p "Releasing @$VERSION version - are you sure? (y/n) " -n 1 -r
18+
echo
19+
20+
if [[ $REPLY =~ ^[Yy]$ ]]; then
21+
# pre release task
22+
npm run lint
23+
npm run test
24+
25+
# bump version
26+
npm version $VERSION
27+
NEW_VERSION=$(node -p "require('./package.json').version")
28+
echo Releasing ${NEW_VERSION} ...
29+
30+
# github release
31+
npm run prepublishOnly
32+
git add CHANGELOG.md
33+
git commit -m "chore: changelog"
34+
git push
35+
git push origin refs/tags/v${NEW_VERSION}
36+
echo "✅ released to Github"
37+
38+
# npm release
39+
npm publish
40+
echo "✅ released to npm"
41+
else
42+
echo Cancelled
43+
fi
44+
break
45+
done
46+

0 commit comments

Comments
 (0)