Skip to content

Commit

Permalink
fix: hotfix for action
Browse files Browse the repository at this point in the history
  • Loading branch information
iFadi committed Mar 28, 2024
1 parent 8c45724 commit e54134d
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions .github/scripts/update_plugin_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,25 @@ echo "Running update_plugin_version.sh..."
latest_version=$(git describe --tags $(git rev-list --tags --max-count=1))
echo "Latest version determined: $latest_version"

# Check if latest_version is not empty
if [ -z "$latest_version" ]; then
echo "Error: Could not determine latest version."
exit 1
fi
# Remove the 'v' prefix from the version string
formatted_version=${latest_version#v}
echo "Formatted version for update: $formatted_version"

# Attempt to update the plugin.php file
# Update the plugin.php file
echo "Attempting to update plugin.php with latest version..."
sed -i "s/\$version = '[^']*';/\$version = '$latest_version';/" plugin.php
sed -i "s/\$version = '[^']*';/\$version = '$formatted_version';/" plugin.php

# Check if plugin.php was updated
if ! git diff --exit-code --quiet plugin.php; then
echo "plugin.php was updated. Proceeding with commit..."

# Configure Git (these details will appear in the commit log)
git config --global user.email "fadi@asbih.com"
git config --global user.name "Fadi Asbih"
git config --global user.email "you@example.com"
git config --global user.name "Your Name"

# Add and commit changes
git add plugin.php
git commit -m "chore: update version in plugin.php to $latest_version"
git commit -m "chore: update version in plugin.php to $formatted_version"
else
echo "No changes to plugin.php detected."
fi

0 comments on commit e54134d

Please sign in to comment.