Use GNU sed for OSX

OSX already come with a version of sed that is incompatible with the GNU sed from Linux.
We can install same version used by Linux so the commands will be
compatible.

Signed-off-by: Alexandre Eher <alexandre@eher.com.br>
This commit is contained in:
Alexandre Eher
2019-09-25 01:02:17 +02:00
parent 992019b1e1
commit 89ffd15e4f
2 changed files with 14 additions and 7 deletions

View File

@@ -5,12 +5,17 @@ if [ -n "$GITHUB_API_TOKEN" ]; then
auth="-H 'Authorization: token $GITHUB_API_TOKEN'"
fi
sed="sed"
if hash gsed 2>/dev/null; then
sed="gsed"
fi
versions=$(curl $auth -s https://api.github.com/repos/php/php-src/git/refs/tags | # Fetch all tags
grep '"ref":' | # Filter by refs
grep 'php-' | # Filter only those related to php-xxxx
sed 's/\"ref\"://' | # Remove '"ref":'
sed 's/\"refs\/tags\/php-//' | # Remove '"refs/tags/php-"'
sed 's/\",//') # Remove last '",'
$sed 's/\"ref\"://' | # Remove '"ref":'
$sed 's/\"refs\/tags\/php-//' | # Remove '"refs/tags/php-"'
$sed 's/\",//') # Remove last '",'
# As per the documentation, all versions should be in a single line separated
# by spaces. We use `xargs` for this.