diff --git a/bin/compile b/bin/compile index e8e6262..1ccd64d 100755 --- a/bin/compile +++ b/bin/compile @@ -1,5 +1,21 @@ #!/usr/bin/env bash +function fetch_pear() { + set +o xtrace + if [ -n $GITHUB_TOKEN ]; then + auth_flag="-H 'Authorization: token $GITHUB_TOKEN'" + fi + + latest_tag=$(curl -sSfL "${auth_flag}" https://api.github.com/repos/pear/pearweb_phars/releases/latest | jq -r .tag_name) + curl -sSfL "${auth_flag}" --retry 2 -O https://raw.githubusercontent.com/pear/pearweb_phars/${latest_tag}/go-pear.phar + + if [ ! -f go-pear.phar ]; then + echo "Latest PEAR tarball not found" + exit 1 + fi + set -o xtrace +} + set -o errexit if [[ ! $VERSION ]] ; then @@ -21,7 +37,8 @@ php-build -i development "${VERSION}" "${INSTALL_DEST}/${VERSION}" pushd "${INSTALL_DEST}/${VERSION}" # pear -curl -fsSL -O http://pear.php.net/go-pear.phar +fetch_pear + env TZ=UTC $TRAVIS_BUILD_DIR/bin/install-pear rm go-pear.phar "$INSTALL_DEST/$VERSION/bin/pear" config-set php_ini "$INSTALL_DEST/$VERSION/etc/php.ini" system