File tree 1 file changed +42
-0
lines changed
1 file changed +42
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ set -e
4
+
5
+ if ! command -v jq & > /dev/null; then
6
+ echo " Error: 'jq' is required but not installed. Please install 'jq' to proceed"
7
+ exit 1
8
+ fi
9
+
10
+ if [ " $# " -ne 1 ]; then
11
+ echo " Usage: $0 <new_version>"
12
+ exit 1
13
+ fi
14
+
15
+ cd " $( dirname " $0 " ) /.."
16
+
17
+ PROJECT=$( jq -r .name custom_components/knmi/manifest.json)
18
+ CURRENT_VERSION=$( jq -r .version custom_components/knmi/manifest.json)
19
+ NEW_VERSION=$1
20
+
21
+ echo " Updating $PROJECT version from $CURRENT_VERSION to $NEW_VERSION "
22
+
23
+ # Update project files that contain the version number (not perfect, but there is manual verification).
24
+ sed -i " s/$CURRENT_VERSION /$NEW_VERSION /g" .github/ISSUE_TEMPLATE/issue.yaml custom_components/knmi/const.py custom_components/knmi/manifest.json
25
+
26
+ echo " Are the updated project files correct? Confirm with 'yes' or 'no':"
27
+ read -r CONFIRMATION
28
+
29
+ if [[ " $CONFIRMATION " == " yes" ]]; then
30
+ echo " Committing changes..."
31
+ git add .github/ISSUE_TEMPLATE/issue.yaml custom_components/knmi/const.py custom_components/knmi/manifest.json
32
+ git commit -m " Release version \` $NEW_VERSION \` "
33
+ git tag " $NEW_VERSION "
34
+ echo " Pushing changes..."
35
+ git push origin
36
+ git push origin --tags
37
+ echo " Release commit and tag $NEW_VERSION created and pushed successfully"
38
+ else
39
+ echo " Aborted, going to revert changes..."
40
+ git checkout -- .github/ISSUE_TEMPLATE/issue.yaml custom_components/knmi/const.py custom_components/knmi/manifest.json
41
+ echo " Changes reverted"
42
+ fi
You can’t perform that action at this time.
0 commit comments