Skip to content

Commit b12dd62

Browse files
committed
Fix get_stable_release_tag
1 parent 792acf0 commit b12dd62

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

scripts/build_partials/version.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,11 @@ check_stable() {
2626
# Function to get the latest stable release tag for a PHP version.
2727
get_stable_release_tag() {
2828
source=$1
29-
if [ "$source" = "web-php" ]; then
30-
curl -sL https://www.php.net/releases/feed.php | grep -Po -m 1 "php-($PHP_VERSION.[0-9]+)" | head -n 1
29+
if [ "$source" = "--web-php" ]; then
30+
release_tag="$(curl -sL https://www.php.net/releases/feed.php | grep -Po -m 1 "php-(${php_version//./\\.}\.[0-9]+)" | head -n 1)"
31+
[[ -z $release_tag ]] && echo "php-$(curl -sL https://www.php.net/releases | grep -Po -m 1 "${php_version//./\\.}\.[0-9]+" | head -n 1)" || echo "$release_tag"
3132
else
32-
curl -H "Authorization: Bearer $GITHUB_TOKEN" -sL "https://api.github.com/repos/php/php-src/git/matching-refs/tags%2Fphp-$PHP_VERSION." | grep -Eo "php-[0-9]+\.[0-9]+\.[0-9]+\"" | tail -1 | cut -d '"' -f 1
33+
curl -H "Authorization: Bearer $GITHUB_TOKEN" -sL "https://api.github.com/repos/php/php-src/git/matching-refs/tags%2Fphp-$php_version." | grep -Eo "php-[0-9]+\.[0-9]+\.[0-9]+\"" | tail -1 | cut -d '"' -f 1
3334
fi
3435
}
3536

scripts/check-php-version.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
# Function to get the latest stable release tag for a PHP version.
44
get_stable_release_tag() {
55
source=$1
6-
if [ "$source" = "web-php" ]; then
7-
echo "php-$(curl -sL https://www.php.net/releases | grep -Po -m 1 "$php_version\.[0-9]+" | head -n 1)"
6+
if [ "$source" = "--web-php" ]; then
7+
release_tag="$(curl -sL https://www.php.net/releases/feed.php | grep -Po -m 1 "php-(${php_version//./\\.}\.[0-9]+)" | head -n 1)"
8+
[[ -z $release_tag ]] && echo "php-$(curl -sL https://www.php.net/releases | grep -Po -m 1 "${php_version//./\\.}\.[0-9]+" | head -n 1)" || echo "$release_tag"
89
else
910
curl -H "Authorization: Bearer $GITHUB_TOKEN" -sL "https://api.github.com/repos/php/php-src/git/matching-refs/tags%2Fphp-$php_version." | grep -Eo "php-[0-9]+\.[0-9]+\.[0-9]+\"" | tail -1 | cut -d '"' -f 1
1011
fi
@@ -21,8 +22,7 @@ else
2122
for php_version in "${php_versions_to_check[@]}"; do
2223
# Fetch new and existing version, compare and add to php_versions_to_build array.
2324
# Here we only check for stable as both RC and nightly should be built.
24-
existing_version=$(curl -sL https://github.com/shivammathur/php-builder/releases/download/"$php_version"/php"$php_version".log
25-
)
25+
existing_version=$(curl -sL https://github.com/shivammathur/php-builder/releases/download/"$php_version"/php"$php_version".log)
2626
new_version="$(get_stable_release_tag "$3")"
2727
if [ "$new_version" != "$existing_version" ]; then
2828
php_versions_to_build+=("$php_version")

scripts/release.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@ log_build() {
1010
# Function to get the latest stable release tag for a PHP version.
1111
get_stable_release_tag() {
1212
source=$1
13-
if [ "$source" = "web-php" ]; then
14-
curl -sL https://www.php.net/releases/feed.php | grep -Po -m 1 "php-($PHP_VERSION.[0-9]+)" | head -n 1
13+
if [ "$source" = "--web-php" ]; then
14+
release_tag="$(curl -sL https://www.php.net/releases/feed.php | grep -Po -m 1 "php-(${php_version//./\\.}\.[0-9]+)" | head -n 1)"
15+
[[ -z $release_tag ]] && echo "php-$(curl -sL https://www.php.net/releases | grep -Po -m 1 "${php_version//./\\.}\.[0-9]+" | head -n 1)" || echo "$release_tag"
1516
else
16-
curl -H "Authorization: Bearer $GITHUB_TOKEN" -sL "https://api.github.com/repos/php/php-src/git/matching-refs/tags%2Fphp-$PHP_VERSION." | grep -Eo "php-[0-9]+\.[0-9]+\.[0-9]+\"" | tail -1 | cut -d '"' -f 1
17+
curl -H "Authorization: Bearer $GITHUB_TOKEN" -sL "https://api.github.com/repos/php/php-src/git/matching-refs/tags%2Fphp-$php_version." | grep -Eo "php-[0-9]+\.[0-9]+\.[0-9]+\"" | tail -1 | cut -d '"' -f 1
1718
fi
1819
}
1920

0 commit comments

Comments
 (0)