PHP Version Release #4295
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: PHP Version Release | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'PHP version (e.g. 8.4.3)' | |
| required: true | |
| type: string | |
| workflow_call: | |
| inputs: | |
| version: | |
| description: 'PHP version (e.g. 8.4.3)' | |
| required: true | |
| type: string | |
| permissions: | |
| contents: write | |
| jobs: | |
| php-version-release: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y curl jq | |
| - name: Fetch PHP CLI tarballs | |
| continue-on-error: true | |
| run: | | |
| VERSION="${{ inputs.version || github.event.inputs.version }}" | |
| echo "Fetching static-php-cli tarballs for PHP version: $VERSION" | |
| mkdir -p downloads | |
| # Fetch file listings using JSON API and find matching tarballs | |
| echo "Fetching from bulk repository..." | |
| curl -sS "https://dl.static-php.dev/static-php-cli/bulk/?format=json" | \ | |
| jq -r ".[] | select(.name | test(\"php-${VERSION}-cli\")) | .full_path" \ | |
| >> matching_filepaths.txt || true | |
| echo "Fetching from windows/spc-max repository..." | |
| curl -sS "https://dl.static-php.dev/static-php-cli/windows/spc-max/?format=json" | \ | |
| jq -r ".[] | select(.name | test(\"php-${VERSION}-cli\")) | .full_path" \ | |
| >> matching_filepaths.txt || true | |
| # Check if we found anything | |
| if [ -s matching_filepaths.txt ]; then | |
| echo "Found matching file paths from static-php.dev:" | |
| cat matching_filepaths.txt | |
| # Download and rename each file | |
| while read -r filepath; do | |
| filename=$(basename "$filepath") | |
| echo "Downloading: $filename" | |
| if curl -L -o "downloads/temp_${filename}" "https://dl.static-php.dev/${filepath}"; then | |
| # Extract architecture and file extension for both .tar.gz and .zip files | |
| if [[ "$filename" =~ php-${VERSION}-cli-(.+)\.tar\.gz$ ]]; then | |
| arch="${BASH_REMATCH[1]}" | |
| fileext="tar.gz" | |
| elif [[ "$filename" =~ php-${VERSION}-cli-(.+)\.zip$ ]]; then | |
| arch="${BASH_REMATCH[1]}" | |
| fileext="zip" | |
| else | |
| echo "Error: Could not extract arch/file extension from $filename" | |
| rm "downloads/temp_${filename}" || true | |
| continue | |
| fi | |
| # Rename file to new format | |
| new_filename="php-${VERSION}-cli-${arch}.${fileext}" | |
| mv "downloads/temp_${filename}" "downloads/${new_filename}" | |
| echo "Renamed to: $new_filename" | |
| else | |
| echo "Warning: Failed to download $filename" | |
| rm "downloads/temp_${filename}" || true | |
| fi | |
| done < matching_filepaths.txt | |
| rm -f matching_filepaths.txt | |
| else | |
| echo "Warning: No matching files found from static-php.dev for version $VERSION" | |
| rm -f matching_filepaths.txt | |
| fi | |
| echo "All files in downloads directory:" | |
| ls -la downloads/ | |
| - name: Extract major version | |
| run: | | |
| echo "VERSION_MAJOR=$(echo ${{ inputs.version || github.event.inputs.version }} | cut -d'.' -f1,1)" >> $GITHUB_ENV | |
| - name: Create release with all assets | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| target_commitish: "b249226a4b2e29219091637c9658c2024e709d3a" | |
| tag_name: "v${{ inputs.version || github.event.inputs.version }}" | |
| name: "v${{ inputs.version || github.event.inputs.version }}" | |
| body: | | |
| # PHP v${{ inputs.version || github.event.inputs.version }} | |
| Changelog: [What's changed in v${{ inputs.version || github.event.inputs.version }}?](https://www.php.net/ChangeLog-${{ env.VERSION_MAJOR }}.php#${{ inputs.version || github.event.inputs.version }}) | |
| ## Sources | |
| * **Official PHP**: https://php.net/releases | |
| * **Windows Builds**: https://windows.php.net/downloads/releases | |
| * **Static PHP CLI**: https://dl.static-php.dev/static-php-cli/ | |
| draft: false | |
| prerelease: false | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| files: downloads/** |