Skip to content
This repository has been archived by the owner on Oct 25, 2024. It is now read-only.

Build and publish PHP binaries #1

Build and publish PHP binaries

Build and publish PHP binaries #1

Workflow file for this run

name: Build PHP binaries
on:
push:
branches: "**"
tags-ignore: "php-**"
pull_request:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
linux:
name: Linux (PM ${{ matrix.pm-version-major }})
runs-on: ubuntu-20.04
strategy:
matrix:
pm-version-major: [4, 5]
steps:
- uses: actions/checkout@v4
- name: Install tools and dependencies
run: |
sudo apt-get update
sudo apt-get install make autoconf automake libtool libtool-bin m4 wget libc-bin gzip bzip2 bison g++ git re2c
- name: Prepare compile.sh download cache
id: download-cache
uses: actions/cache@v3
with:
path: ./download_cache
key: compile-sh-cache-ssl-https-${{ hashFiles('./compile.sh') }}
restore-keys: compile-sh-cache-ssl-https-
- name: Compile PHP
run: |
# Used "set -ex" instead of hashbang since script isn't executed with hashbang
set -ex
trap "exit 1" ERR
./compile.sh -t linux64 -j 4 -g -P ${{ matrix.pm-version-major }} -c ./download_cache -D
- name: Create tarball
run: |
tar -czf ./PHP-Linux-x86_64-PM${{ matrix.pm-version-major }}.tar.gz bin
tar -czf ./PHP-Linux-x86_64-PM${{ matrix.pm-version-major }}-debugging-symbols.tar.gz bin-debug
- name: Upload artifacts
uses: actions/upload-artifact@v4
if: always()
with:
name: Linux-PM${{ matrix.pm-version-major }}
path: |
./PHP-Linux-x86_64-PM${{ matrix.pm-version-major }}*.tar.gz
install.log
compile.sh
if-no-files-found: error
- name: Prepare workspace for upload
if: failure()
run: tar -czf workspace.tar.gz install_data
- name: Upload workspace
uses: actions/upload-artifact@v4
if: failure()
with:
name: Linux-workspace-PM${{ matrix.pm-version-major }}
path: |
workspace.tar.gz
if-no-files-found: error
windows:
name: Windows (PM ${{ matrix.pm-version-major }})
runs-on: windows-2019
strategy:
matrix:
pm-version-major: [ 4, 5 ]
steps:
- uses: actions/checkout@v4
- name: Install tools and dependencies
run: choco install wget --no-progress
- name: Compile PHP
run: .\windows-compile-vs.bat
env:
VS_EDITION: Enterprise
SOURCES_PATH: ${{ github.workspace }}\pocketmine-php-sdk
PM_VERSION_MAJOR: ${{ matrix.pm-version-major }}
- name: Rename artifacts
run: |
mkdir temp
move php-debug-pack-*.zip temp/PHP-Windows-x64-PM${{ matrix.pm-version-major }}-debugging-symbols.zip
move php-*.zip temp/PHP-Windows-x64-PM${{ matrix.pm-version-major }}.zip
move temp\*.zip .
- name: Upload artifacts
uses: actions/upload-artifact@v4
if: always()
with:
name: Windows-PM${{ matrix.pm-version-major }}
path: |
PHP-Windows-x64*.zip
compile.log
windows-compile-vs.bat
if-no-files-found: error
publish:
name: Publish binaries
needs: [linux, macos, windows]

Check failure on line 114 in .github/workflows/main.yml

View workflow run for this annotation

GitHub Actions / Build PHP binaries

Invalid workflow file

The workflow is not valid. .github/workflows/main.yml (Line: 114, Col: 20): Job 'publish' depends on unknown job 'macos'.
runs-on: ubuntu-20.04
if: ${{ startsWith(github.ref_name, 'php/') && github.ref_type == 'branch' && !contains(github.event.head_commit.message, '[no release]') }}
steps:
- uses: actions/checkout@v4
- name: Set version information
id: version
run: |
echo PHP_VERSION=$(echo ${{ github.ref_name }} | cut -d / -f2) >> $GITHUB_OUTPUT
- name: Update latest tag target
run: |
git tag -f php-${{ steps.version.outputs.PHP_VERSION }}-latest
git push -f origin php-${{ steps.version.outputs.PHP_VERSION }}-latest
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: ${{ github.workspace }}
- name: Update latest branch release
uses: ncipollo/[email protected]
with:
artifacts: |
${{ github.workspace }}/Linux-PM*/*.tar.gz
${{ github.workspace }}/Windows-PM*/*.zip
makeLatest: ${{ github.ref_name == github.event.repository.default_branch }}
name: PHP ${{ steps.version.outputs.PHP_VERSION }} - Latest (Build ${{ github.run_number }})
tag: php-${{ steps.version.outputs.PHP_VERSION }}-latest
commit: ${{ github.sha }}
allowUpdates: true
bodyFile: ${{ github.workspace }}/changelog.md
removeArtifacts: true
prerelease: ${{ endsWith(github.ref_name, '-preview') }}
- name: Publish unique release
uses: ncipollo/[email protected]
with:
artifacts: |
${{ github.workspace }}/Linux-PM*/*.tar.gz
${{ github.workspace }}/Windows-PM*/*.zip
makeLatest: false
name: PHP ${{ steps.version.outputs.PHP_VERSION }} (Build ${{ github.run_number }})
tag: php-${{ steps.version.outputs.PHP_VERSION }}-build-${{ github.run_number }}
commit: ${{ github.sha }}
bodyFile: ${{ github.workspace }}/changelog.md
prerelease: ${{ endsWith(github.ref_name, '-preview') }}