Skip to content

Commit 2e25a10

Browse files
authored
Merge pull request #471 from infosiftr/skip-pre-release-cli
Skip wp-cli releases that don't have release artifacts
2 parents 0df5de0 + 25dcdc0 commit 2e25a10

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

update.sh

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,24 @@ phpVersions=( "${phpVersions[@]%/}" )
1212
current="$(curl -fsSL 'https://api.wordpress.org/core/version-check/1.7/' | jq -r '.offers[0].current')"
1313
sha1="$(curl -fsSL "https://wordpress.org/wordpress-$current.tar.gz.sha1")"
1414

15-
cliVersion="$(
15+
cliPossibleVersions=( $(
1616
git ls-remote --tags 'https://github.com/wp-cli/wp-cli.git' \
1717
| sed -r 's!^[^\t]+\trefs/tags/v([^^]+).*!\1!g' \
18-
| tail -1
19-
)"
20-
cliSha512="$(curl -fsSL "https://github.com/wp-cli/wp-cli/releases/download/v${cliVersion}/wp-cli-${cliVersion}.phar.sha512")"
21-
22-
echo "$current (CLI $cliVersion)"
18+
| sort --version-sort --reverse
19+
)
20+
)
21+
cliVersion=
22+
cliSha512=
23+
for cliPosVer in "${cliPossibleVersions[@]}"; do
24+
cliUrl="https://github.com/wp-cli/wp-cli/releases/download/v${cliPosVer}/wp-cli-${cliPosVer}.phar.sha512"
25+
if cliSha512="$(curl -fsSL "$cliUrl" 2>/dev/null)"; then
26+
cliVersion="$cliPosVer"
27+
break
28+
fi
29+
done
30+
echo "$current (CLI '$cliVersion')"
31+
# make sure we get a cliVersion
32+
[ -n "$cliVersion" ]
2333

2434
declare -A variantExtras=(
2535
[apache]="$(< apache-extras.template)"

0 commit comments

Comments
 (0)