Skip to content

Commit

Permalink
fix: update plugin version script
Browse files Browse the repository at this point in the history
  • Loading branch information
iFadi committed Mar 28, 2024
1 parent b977da5 commit 88dd0ee
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions .github/scripts/update_plugin_version.sh
Original file line number Diff line number Diff line change
@@ -1,27 +1,32 @@
#!/bin/bash

echo "Running update_plugin_version.sh..."

# Get the latest version (assuming it's stored as a Git tag)
latest_version=$(git describe --tags `git rev-list --tags --max-count=1`)
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

# Update the plugin.php file
# This sed command is tailored for the $version assignment line as shown in your plugin.php
# Attempt to update the plugin.php file
echo "Attempting to update plugin.php with latest version..."
sed -i "s/\$version = '[^']*';/\$version = '$latest_version';/" plugin.php

# Check if plugin.php was updated
if ! git diff --exit-code --quiet plugin.php; then
# Configure Git (this should match the configuration used for other git operations within your actions)
git config --global user.email "email@domain.com"
git config --global user.name "Max"
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"

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

0 comments on commit 88dd0ee

Please sign in to comment.