Skip to content

Commit

Permalink
chore: + version.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
amithm7 committed Jan 28, 2023
1 parent 0de01ae commit 3fc112e
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash

echo "Cur version: $(cat package.json | grep version | head -1 | awk -F: '{ print $2 }' | sed 's/[ ",]//g')"

if [ -z "$1" ]; then
echo "Please provide a version number as an argument."
exit 1
fi

echo "New version: $1"

sed -i 's/"version": "[0-9]*\.[0-9]*\.[0-9]*"/"version": "'$1'"/g' package.json src/manifest.json

# update package-lock.json
npm install

git add package.json src/manifest.json package-lock.json
git commit -m "chore: v$1"

git tag "v$1"

git diff HEAD^ HEAD -U0

read -p "Push changes? [y/N] " -n 1 -r
echo # new line

if [[ $REPLY =~ ^[Yy]$ ]]
echo "Pushing new version..."
git push origin main
git push origin --tags
fi

0 comments on commit 3fc112e

Please sign in to comment.