michals-silly-game-frontend/update-version.sh

29 lines
804 B
Bash
Raw Normal View History

2025-04-08 10:37:29 +00:00
#!/bin/bash
set -e
# Get current version
current_version=$(jq -r '.version' package.json)
echo "Current version: $current_version"
# Determine new version (example: increment patch)
IFS='.' read -r major minor patch <<< "$current_version"
new_patch=$((patch + 1))
new_version="$major.$minor.$new_patch"
echo "New version: $new_version"
# Update package.json
jq ".version = \"$new_version\"" package.json > temp.json && mv temp.json package.json
# Optional: Commit and tag
2025-04-08 10:51:49 +00:00
git config --global user.name ${{ secrets.PACKAGES_USER }}
git add package.json
2025-04-08 10:48:35 +00:00
echo "adding succeeded"
git commit -m "Bump version to $new_version"
2025-04-08 10:48:35 +00:00
echo "commiting succeeded"
git tag -a "v$new_version" -m "Release version $new_version"
2025-04-08 10:48:35 +00:00
echo "tagging succeeded"
2025-04-08 10:55:30 +00:00
git remote -v
2025-04-08 10:48:35 +00:00
git push main HEAD --tags
echo "pushing succeeded"