-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
12 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |