@@ -51,30 +51,10 @@ jobs:
5151 caddy/go.sum
5252 - name : Determine PHP version
5353 id : determine-php-version
54- env :
55- GH_TOKEN : ${{ github.token }}
5654 run : |
57- # Try php.net API first
58- if curl -fsSL 'https://www.php.net/releases/index.php?json&max=1&version=8.5' -o version.json 2>/dev/null; then
59- version="$(jq -r 'keys[0]' version.json 2>/dev/null)" || true
60- archive="$(jq -r '.[] .source[] | select(.filename |endswith(".xz")) | "https://www.php.net/distributions/" + .filename' version.json 2>/dev/null)" || true
61- if [ -n "$version" ] && [ "$version" != "null" ] && [ -n "$archive" ] && [ "$archive" != "null" ]; then
62- echo "version=$version" >> "$GITHUB_OUTPUT"
63- echo "archive=$archive" >> "$GITHUB_OUTPUT"
64- exit 0
65- fi
66- fi
67-
68- echo "php.net API unavailable, falling back to GitHub releases..."
69-
70- # Fallback: use the latest GitHub release from php/php-src
71- version=$(gh release list --repo php/php-src --exclude-drafts --exclude-pre-releases --json tagName --jq '[.[].tagName | select(startswith("php-8.5."))] | first | ltrimstr("php-")') || true
72- if [ -z "$version" ] || [ "$version" = "null" ]; then
73- echo "::error::Failed to determine PHP version from both php.net and GitHub"
74- exit 1
75- fi
76- echo "version=$version" >> "$GITHUB_OUTPUT"
77- echo "archive=https://github.com/php/php-src/archive/refs/tags/php-${version}.tar.gz" >> "$GITHUB_OUTPUT"
55+ curl -fsSL 'https://www.php.net/releases/index.php?json&max=1&version=8.5' -o version.json 2>/dev/null || curl -fsSL 'https://phpmirror.static-php.dev/releases/index.php?json&max=1&version=8.5' -o version.json
56+ echo version="$(jq -r 'keys[0]' version.json)" >> "$GITHUB_OUTPUT"
57+ echo archive="$(jq -r '.[] .source[] | select(.filename |endswith(".xz")) | "https://www.php.net/distributions/" + .filename' version.json)" >> "$GITHUB_OUTPUT"
7858 - name : Cache PHP
7959 id : cache-php
8060 uses : actions/cache@v5
8565 name : Compile PHP
8666 run : |
8767 mkdir php/
88- case "${URL}" in
89- *.xz) curl -fsSL "${URL}" | tar -Jx -C php --strip-components=1 ;;
90- *) curl -fsSL "${URL}" | tar -zx -C php --strip-components=1 ;;
91- esac
68+ MIRROR_URL=$(echo "${URL}" | sed 's|https://www.php.net|https://phpmirror.static-php.dev|')
69+ (curl -fsSL "${URL}" || curl -fsSL "${MIRROR_URL}") | tar -Jx -C php --strip-components=1
9270 cd php/
93- # GitHub source archives don't include ./configure, generate it
94- if [ ! -f ./configure ]; then
95- sudo apt-get install -y re2c
96- ./buildconf -f
97- fi
9871 ./configure \
9972 CFLAGS="$CFLAGS" \
10073 LDFLAGS="$LDFLAGS" \
0 commit comments