Skip to content

Commit 37034f4

Browse files
committed
chore: + version.sh
1 parent 0de01ae commit 37034f4

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

version.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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+
# ask if changes should be pushed (default: no)
25+
read -p "Push changes? [y/N] " -n 1 -r
26+
echo # new line
27+
28+
if [[ $REPLY =~ ^[Yy]$ ]]
29+
echo "Pushing new version..."
30+
git push origin main
31+
git push origin --tags
32+
fi

0 commit comments

Comments
 (0)