Build #47
Workflow file for this run
This file contains 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: Build | |
on: | |
release: | |
types: | |
- created | |
workflow_dispatch: | |
permissions: | |
contents: write | |
jobs: | |
phar: | |
name: Build PHAR | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 8.3 | |
coverage: none | |
tools: box | |
- name: Install dependencies | |
uses: ramsey/composer-install@v3 | |
- name: Build PHAR | |
run: box compile | |
- name: Ensure the PHAR works | |
run: build/automate.phar --version | |
- uses: actions/upload-artifact@v4 | |
name: Upload the PHAR artifact | |
with: | |
name: automate-phar | |
path: build/automate.phar | |
static-binary: | |
name: Build static binary ${{ matrix.filename }} | |
needs: [ phar ] | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
# Linux amd64 | |
- runs_on: ubuntu-latest | |
spc_binary: https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-linux-x86_64 | |
build_options: --build-micro --with-upx-pack | |
filename: automate-linux-amd64 | |
# MacOS amd64 | |
- runs_on: macos-13 | |
spc_binary: https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-macos-x86_64 | |
build_options: --build-micro | |
filename: automate-darwin-amd64 | |
# MacOS arm64 | |
- runs_on: macos-14 | |
spc_binary: https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-macos-aarch64 | |
build_options: --build-micro | |
filename: automate-darwin-arm64 | |
runs-on: ${{ matrix.runs_on }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
path: build | |
merge-multiple: true | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 8.3 | |
coverage: none | |
- name: Get static-php-cli binary | |
run: | | |
curl ${{ matrix.spc_binary }} -o bin/spc | |
chmod +x bin/spc | |
- name: Fixing missing requirements | |
run: | | |
bin/spc doctor --auto-fix | |
- name: Install UPX package | |
if: ${{ contains(matrix.build_options, 'upx') }} | |
run: | | |
bin/spc install-pkg upx | |
- name: Build static binary | |
run: | | |
bin/spc download --for-extensions="dom,gmp,openssl,phar,sodium,xml,xmlwriter,filter,tokenizer,iconv,mbstring" --with-php=8.3 | |
bin/spc build "dom,gmp,openssl,phar,sodium,xml,xmlwriter,filter,tokenizer,iconv,mbstring" ${{ matrix.build_options }} | |
bin/spc micro:combine build/automate.phar --output build/${{ matrix.filename }} | |
- name: Ensure the static binary works | |
run: build/${{ matrix.filename }} --version | |
- uses: actions/upload-artifact@v4 | |
name: Upload the static binary artifact | |
with: | |
name: ${{ matrix.filename }} | |
path: build/${{ matrix.filename }} | |
release: | |
name: Upload artifacts to the release | |
if: github.event_name == 'release' | |
needs: [ static-binary ] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
path: build | |
merge-multiple: true | |
- name: Upload files | |
run: | | |
gh release upload ${{ github.ref_name }} ./build/automate.phar | |
gh release upload ${{ github.ref_name }} ./build/automate-linux-amd64 | |
gh release upload ${{ github.ref_name }} ./build/automate-darwin-amd64 | |
gh release upload ${{ github.ref_name }} ./build/automate-darwin-arm64 | |
env: | |
GH_TOKEN: ${{ github.token }} |