-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrelease.sh
23 lines (22 loc) · 837 Bytes
/
release.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/env bash
# takes the tag as an argument (e.g. v0.1.0)
if [ -n "$1" ]; then
if [[ "$1" =~ ^[0-9]{0,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
read -r -p "Are you sure to upgrade to v$1 ? [y/N] " response
if [[ "$response" =~ ^([yY][eE][sS]|[yY])$ ]]
then
# update the version in manifest.json
sed -i '' -E "s|\"version\": \".*\"|\"version\": \"${1#v}\"|" custom_components/shopping_list_with_grocy/manifest.json
git add custom_components/shopping_list_with_grocy/manifest.json
git commit -m "chore(release): prepare for v$1"
git tag "v$1"
git push --atomic origin main "v$1"
else
echo "Operation canceled"
fi
else
echo "The version should be X.X.X"
fi
else
echo "Please provide a tag"
fi