Skip to content

Bump actions/download-artifact from 3 to 4 #164

Bump actions/download-artifact from 3 to 4

Bump actions/download-artifact from 3 to 4 #164

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
if: "!contains(github.event.head_commit.message, '[ci skip]')"
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 curl libc-bin gzip bzip2 bison g++ git re2c ca-certificates
- 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.tar.gz bin
tar -czf ./PHP-Linux-x86_64-PM${{ matrix.pm-version-major }}-debugging-symbols.tar.gz bin-debug
zip -r Linux.zip ./PHP_Linux-x86_64.tar.gz
- name: Upload artifacts
uses: actions/upload-artifact@v3
if: always()
with:
name: Linux-PM${{ matrix.pm-version-major }}
path: |
Linux.zip
./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@v3
if: failure()
with:
name: Linux-workspace-PM${{ matrix.pm-version-major }}
path: |
workspace.tar.gz
if-no-files-found: error
macos:
name: MacOS (PM ${{ matrix.pm-version-major }})
runs-on: macos-11.0
if: "!contains(github.event.head_commit.message, '[ci skip]')"
strategy:
matrix:
pm-version-major: [ 4, 5 ]
steps:
- uses: actions/checkout@v4
- name: Install tools and dependencies
run: brew install libtool autoconf automake pkg-config bison 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: |
export PATH="/usr/local/opt/bison/bin:$PATH"
set -ex
trap "exit 1" ERR
./compile.sh -t mac-x86-64 -j4 -g -P ${{ matrix.pm-version-major }} -c ./download_cache -D
- name: Create tarball
run: |
tar -czf ./PHP-MacOS-x86_64-PM${{ matrix.pm-version-major }}.tar.gz bin
tar -czf ./PHP-MacOS-x86_64-PM${{ matrix.pm-version-major }}-debugging-symbols.tar.gz bin-debug
- name: Upload artifacts
uses: actions/upload-artifact@v3
if: always()
with:
name: MacOS-PM${{ matrix.pm-version-major }}
path: |
./PHP-MacOS-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@v3
if: failure()
with:
name: MacOS-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
if: "!contains(github.event.head_commit.message, '[ci skip]')"
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@v3
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]
runs-on: ubuntu-20.04
if: "${{!contains(github.event.head_commit.message, '[ci skip]') && github.ref == 'refs/heads/stable'}}"
steps:
- uses: actions/checkout@v4
- name: Set PHP version outputs
id: php
run: |
VERSION=$(cat compile.sh | grep 'PHP_VERSION=' | sed 's/[^0-9.]*//g')
echo "::set-output name=version::${VERSION}"
TAG=$(echo "${VERSION::3}")
echo "::set-output name=release_tag::${TAG}"
- name: Restore release caches
uses: actions/download-artifact@v4
- name: Create and Publish Release for PM4
uses: marvinpinto/action-automatic-releases@v1.2.1
with:
automatic_release_tag: "${{ steps.php.outputs.release_tag }}"
repo_token: "${{ secrets.GITHUB_TOKEN }}"
title: "PHP ${{ steps.php.outputs.version }} for PM4"
files: |
Linux-PM4/Linux.zip
MacOS-PM4/PHP-*.tar.gz
Windows-PM4/PHP-*.zip
prerelease: false
- name: Create and Publish Release for PM5
uses: marvinpinto/action-automatic-releases@v1.2.1
with:
automatic_release_tag: "${{ steps.php.outputs.release_tag }}-pm5"
repo_token: "${{ secrets.GITHUB_TOKEN }}"
title: "PHP ${{ steps.php.outputs.version }} for PM5"
files: |
Linux-PM5/Linux.zip
MacOS-PM5/PHP-*.tar.gz
Windows-PM5/PHP-*.zip
prerelease: false