Skip to content

Commit 50a961c

Browse files
committed
chore: ⚡ Add release shell scripts
1 parent 6020152 commit 50a961c

File tree

4 files changed

+57
-3
lines changed

4 files changed

+57
-3
lines changed

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@ typings/
119119
##
120120

121121
dist
122-
package-lock.json
123122
lib
124123
.vscode
125124
# FuseBox cache

TODO.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- [] Button

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"name": "cube-react",
3-
"version": "1.0.0",
2+
"name": "@fdg/cube-react",
3+
"version": "0.0.1",
44
"description": "",
55
"main": "index.js",
66
"scripts": {

scripts/release.sh

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

0 commit comments

Comments
 (0)