Skip to content

Commit d4b46cd

Browse files
authored
Merge pull request #40 from rtCamp/enhance/issue-33
Enhance WP version handling
2 parents 0f00621 + 428e638 commit d4b46cd

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

main.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ function setup_wordpress_files() {
204204
cd "$HTDOCS"
205205
export build_root="$(pwd)"
206206

207-
hosts_wp_version=$(cat "$hosts_file" | shyaml get-value "$GITHUB_BRANCH.WP_VERSION" || true)
207+
hosts_wp_version=$(cat "$hosts_file" | shyaml get-value "$GITHUB_BRANCH.WP_VERSION" 2>/dev/null || true)
208208

209209
# Check if WP_VERSION is already defined in hosts.yml
210210
# Priority: 1. hosts.yml, 2. workflow file, else use latest
@@ -214,6 +214,11 @@ function setup_wordpress_files() {
214214
WP_VERSION="latest"
215215
fi
216216

217+
# If it is integer, add trailing `.0`
218+
if [[ "$WP_VERSION" =~ ^[+-]?[0-9]+$ ]]; then
219+
WP_VERSION="$WP_VERSION.0"
220+
fi
221+
217222
if [[ "$WP_MINOR_UPDATE" == "true" ]] && [[ "$WP_VERSION" != "latest" ]]; then
218223
LATEST_MINOR_VERSION=$(
219224
curl -s "https://api.wordpress.org/core/version-check/1.7/?version=$WP_VERSION" |

0 commit comments

Comments
 (0)