Skip to content

Commit

Permalink
Update version-manage.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
sorinmarti authored Apr 16, 2024
1 parent 3ba6448 commit 8d48ebf
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions .github/workflows/version-manage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,32 +14,30 @@ jobs:

- name: Bump version in JSON
shell: bash
run: |
run: |
# Read the current version from the JSON file
VERSION=$(jq -r '.version' ./info.json)
echo "Current version: $VERSION"
# Bump the patch version
IFS='.' read -ra VER <<< "$VERSION"
echo "Current version parts: ${VER[0]}, ${VER[1]}, ${VER[2]}"
if ! [[ "${VER[2]}" =~ ^[0-9]+$ ]]; then
echo "Error: Patch version '${VER[2]}' is not a number."
exit 1
fi
((VER[2]++))
NEW_VERSION="${VER[0]}.${VER[1]}.${VER[2]}"
# Try to increment the patch version using a temporary variable
PATCH=${VER[2]}
echo "Patch before increment: $PATCH"
((PATCH++))
echo "Patch after increment: $PATCH"
NEW_VERSION="${VER[0]}.${VER[1]}.$PATCH"
echo "New version: $NEW_VERSION"
# Assuming the rest of your script continues from here...
# Update the JSON file with the new version
if ! jq --arg v "$NEW_VERSION" '.version = $v' ./info.json > temp.json; then
echo "Failed to update JSON file"
exit 1
fi
mv temp.json ./info.json
jq --arg v "$NEW_VERSION" '.version = $v' ./info.json > temp.json && mv temp.json ./info.json
echo "New version saved"
# Write the new version to a separate file
echo $NEW_VERSION > ./ndr_core/VERSION
echo "Version file updated"
Expand Down

0 comments on commit 8d48ebf

Please sign in to comment.