@@ -14,17 +14,15 @@ main(){
1414 echo " Plugin path: $PLUGIN_PATH "
1515 fi
1616
17- ls -la $PLUGIN_PATH
18-
1917 # Check if the plugin path exists.
2018 if [[ ! -d " ${PLUGIN_PATH} " ]]; then
2119 echo " Plugin path does not exist."
2220 exit 1
2321 fi
2422
25- local CURRENT_WP_VERSION
26- CURRENT_WP_VERSION=$( curl -s https://api.wordpress.org/core/version-check/1.7/ | jq -r ' .offers[0].current' )
27- echo " Current WordPress Version: ${CURRENT_WP_VERSION} "
23+ local CURRENT_WP_VERSION
24+ CURRENT_WP_VERSION=$( curl -s https://api.wordpress.org/core/version-check/1.7/ | jq -r ' .offers[0].current' )
25+ echo " Current WordPress Version: ${CURRENT_WP_VERSION} "
2826
2927 # Get "Tested up to" version from readme.txt
3028 if [[ -f " ${PLUGIN_PATH} /readme.txt" ]]; then
@@ -46,11 +44,21 @@ main(){
4644 if [[ $COMPARE_VERSIONS -eq -1 ]]; then
4745 echo " Tested up to version ($TESTED_UP_TO ) is less than current WordPress version ($CURRENT_WP_VERSION )."
4846 echo " Updating readme.txt with new Tested up to version."
49- sed -i ' ' -E " s/(Tested up to: ).*/\1$CURRENT_WP_VERSION /" ${PLUGIN_PATH} /readme.txt
47+
48+ # Check if the script is running on macOS or Linux, and use the appropriate sed syntax
49+ if [[ " $OSTYPE " == " darwin" * ]]; then
50+ sed -i ' ' -E " s/(Tested up to: ).*/\1$CURRENT_WP_VERSION /" ${PLUGIN_PATH} /readme.txt
51+ else
52+ sed -i -E " s/(Tested up to: ).*/\1$CURRENT_WP_VERSION /" ${PLUGIN_PATH} /readme.txt
53+ fi
5054
5155 # Update README.md if it exists
5256 if [[ -f " ${PLUGIN_PATH} /README.md" ]]; then
53- sed -i ' ' -E " s/(Tested up to: ).*/\1$CURRENT_WP_VERSION /" ${PLUGIN_PATH} /README.md
57+ if [[ " $OSTYPE " == " darwin" * ]]; then
58+ sed -i ' ' -E " s/(Tested up to: ).*/\1$CURRENT_WP_VERSION /" ${PLUGIN_PATH} /README.md
59+ else
60+ sed -i -E " s/(Tested up to: ).*/\1$CURRENT_WP_VERSION /" ${PLUGIN_PATH} /README.md
61+ fi
5462 echo " README.md updated with new Tested up to version."
5563 fi
5664
@@ -71,7 +79,7 @@ main(){
7179 git config user.name " github-actions"
7280 git config user.email
" [email protected] " 7381 git checkout -b " $BRANCH_NAME "
74- git add readme.txt README.md || true
82+ git add ${PLUGIN_PATH} / readme.txt ${PLUGIN_PATH} / README.md || true
7583 git commit -m " Update Tested Up To version to $CURRENT_WP_VERSION "
7684 git push origin " $BRANCH_NAME "
7785
0 commit comments