michals-silly-game-frontend/update-version.sh
2025-04-08 12:37:29 +02:00

24 lines
No EOL
730 B
Bash

#!/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
git config --global user.email "pipeline@example.com"
git config --global user.name "Pipeline Bot"
git add package.json
git commit -m "Bump version to $new_version"
git tag -a "v$new_version" -m "Release version $new_version"
git push origin HEAD --tags