Skip to content

Repository files navigation

Generate Pre-Packaged Binaries for PIE Extensions

Fork of php/pie-ext-binary-builder by James Titcumb.

This fork adds:

  • build-path input — build from a subdirectory (useful for mirror repos where extension source lives in a subfolder)
  • Asset replacement — re-uploads the release asset if one with the same name already exists
  • CI-built distdist/ is built on release via GitHub Actions, not committed to the repo

This is a GitHub action designed to help generate pre-packaged binaries for PIE (PHP Installer for Extensions) extensions and attach them to your GitHub releases. It will:

  • Build a .so from your extension
  • Package the .so in an archive, and name it according to PIE's expectations
  • Upload the archive to your GitHub release

Tip

Looking for Windows support? You probably want php/php-windows-builder

The Action

You must specify a release-tag. This is a tag, for which you have created a release ready for the action to upload the builds to.

Important

If you have enabled immutable releases on your repository, the release must be a draft release, otherwise uploading the assets will fail.

uses: pie-extensions/pie-ext-binary-builder@v1with:
configure-flags: '--enable-something --enable-other-things'build-path: 'ext'# optional, defaults to repo rootrelease-tag: ${{ github.ref_name }}github-token: ${{ secrets.GITHUB_TOKEN }}

Inputs

NameDescriptionRequiredDefault
release-tagThe tag to use when building the extension; there must be an existing draft release for the tagtrue-
github-tokenThe GitHub token to use. Usually ${{ secrets.GITHUB_TOKEN }} would be fine for most cases.true-
configure-flagsIf you need to pass additional flags to the ./configure command, specify them herefalse''
build-pathPath to the extension source directory containing config.m4, relative to repo rootfalse'.'

Outputs

NameDescription
package-pathPath to the generated .zip file

Complete example

This use case is for a scenario where:

  • The action triggers when you push any tag
  • It will create a draft release
  • It will then check out your extension, set up the required PHP version, build it, and upload to the draft release

You would then have to navigate to the draft release and publish it.

name: Build and release binaries for PIEon:
push:
tags:
- '*'permissions:
contents: readjobs:
# This first step will create a *draft* release based on the tag name. In the# case where immutable releases are enabled, the release MUST be in draft# mode, otherwise we would not be able to attach the release assets (since# the release is immutable once published.create-draft-release:
runs-on: ubuntu-latestpermissions:
# contents:write is required to create the draft releasecontents: writesteps:
- uses: actions/checkout@v6with:
fetch-tags: 'true'ref: ${{ github.ref }}
- name: Create draft release from tagenv:
GH_TOKEN: ${{ github.token }}run: gh release create "${{ github.ref_name }}" --title "${{ github.ref_name }}" --draft --notes-from-tagadd-pie-binaries:
needs: [ create-draft-release ]runs-on: ${{ matrix.operating-system }}# The matrix defines which combination of binaries you want to buildstrategy:
matrix:
operating-system:
- ubuntu-latest
- macos-latestphp-versions:
- 8.2
- 8.3
- 8.4zts-mode:
- ts
- ntspermissions:
# contents:write is required to upload to the release assetscontents: writesteps:
- name: Checkoutuses: actions/checkout@v6# Install the desired version of PHP in order to build the extension for it
- name: Setup PHPuses: shivammathur/setup-php@v2with:
php-version: ${{ matrix.php-versions }}env:
phpts: ${{ matrix.zts-mode }}# Finally, this invokes the action, which builds the extension, creates# the archive with the correct naming, and uploads it to the release for# the given tag name
- name: Build and releaseid: php-ext-binary-builderuses: pie-extensions/pie-ext-binary-builder@v1with:
release-tag: ${{ github.ref_name }}github-token: ${{ secrets.GITHUB_TOKEN }}

About

A GitHub action to build and attach shared objects of PIE extensions to their releases

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages