Skip to content

Commit 3fc112e

Browse files
committed
chore: + version.sh
1 parent 0de01ae commit 3fc112e

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

version.sh

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/bash
2+
3+
echo "Cur version: $(cat package.json | grep version | head -1 | awk -F: '{ print $2 }' | sed 's/[ ",]//g')"
4+
5+
if [ -z "$1" ]; then
6+
echo "Please provide a version number as an argument."
7+
exit 1
8+
fi
9+
10+
echo "New version: $1"
11+
12+
sed -i 's/"version": "[0-9]*\.[0-9]*\.[0-9]*"/"version": "'$1'"/g' package.json src/manifest.json
13+
14+
# update package-lock.json
15+
npm install
16+
17+
git add package.json src/manifest.json package-lock.json
18+
git commit -m "chore: v$1"
19+
20+
git tag "v$1"
21+
22+
git diff HEAD^ HEAD -U0
23+
24+
read -p "Push changes? [y/N] " -n 1 -r
25+
echo # new line
26+
27+
if [[ $REPLY =~ ^[Yy]$ ]]
28+
echo "Pushing new version..."
29+
git push origin main
30+
git push origin --tags
31+
fi

0 commit comments

Comments
 (0)