generated from ludeeus/integration_blueprint
-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
if ! command -v jq &> /dev/null; then | ||
echo "Error: 'jq' is required but not installed. Please install 'jq' to proceed" | ||
exit 1 | ||
fi | ||
|
||
if [ "$#" -ne 1 ]; then | ||
echo "Usage: $0 <new_version>" | ||
exit 1 | ||
fi | ||
|
||
cd "$(dirname "$0")/.." | ||
|
||
PROJECT=$(jq -r .name custom_components/kamstrup_403/manifest.json) | ||
CURRENT_VERSION=$(jq -r .version custom_components/kamstrup_403/manifest.json) | ||
NEW_VERSION=$1 | ||
|
||
echo "Updating $PROJECT version from $CURRENT_VERSION to $NEW_VERSION" | ||
|
||
# Update project files that contain the version number (not perfect, but there is manual verification). | ||
sed -i "s/$CURRENT_VERSION/$NEW_VERSION/g" .github/ISSUE_TEMPLATE/issue.yaml custom_components/kamstrup_403/const.py custom_components/kamstrup_403/manifest.json | ||
|
||
echo "Are the updated project files correct? Confirm with 'yes' or 'no':" | ||
read -r CONFIRMATION | ||
|
||
if [[ "$CONFIRMATION" == "yes" ]]; then | ||
echo "Committing changes..." | ||
git add .github/ISSUE_TEMPLATE/issue.yaml custom_components/kamstrup_403/const.py custom_components/kamstrup_403/manifest.json | ||
git commit -m "Release version \`$NEW_VERSION\`" | ||
git tag "$NEW_VERSION" | ||
echo "Pushing changes..." | ||
git push origin | ||
git push origin --tags | ||
echo "Release commit and tag $NEW_VERSION created and pushed successfully" | ||
else | ||
echo "Aborted, going to revert changes..." | ||
git checkout -- .github/ISSUE_TEMPLATE/issue.yaml custom_components/kamstrup_403/const.py custom_components/kamstrup_403/manifest.json | ||
echo "Changes reverted" | ||
fi |