Set the latest swoole version as latest tag. #303
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 Swoole | |
on: [ push ] | |
env: | |
ENGINE: 'swoole' | |
SW_VERSION: 'v5.1.1' | |
COMPOSER_VERSION: '2.6.5' | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_ACCESSTOKEN }} | |
jobs: | |
build: | |
name: Build PHP ${{ matrix.php-version }} Alpine ${{ matrix.alpine-version }} | |
runs-on: '${{ matrix.os }}' | |
env: | |
ALPINE_VERSION: '${{ matrix.alpine-version }}' | |
PHP_VERSION: '${{ matrix.php-version }}' | |
strategy: | |
matrix: | |
os: [ ubuntu-latest ] | |
php-version: [ '8.0', '8.1', '8.2' ] | |
alpine-version: [ '3.14', '3.15', '3.16', '3.17', '3.18','edge' ] | |
exclude: | |
- php-version: '8.2' | |
alpine-version: '3.14' | |
- php-version: '8.2' | |
alpine-version: '3.15' | |
- php-version: '8.2' | |
alpine-version: '3.16' | |
- php-version: '8.2' | |
alpine-version: '3.17' | |
- php-version: '8.1' | |
alpine-version: '3.14' | |
- php-version: '8.1' | |
alpine-version: '3.15' | |
- php-version: '8.0' | |
alpine-version: '3.17' | |
- php-version: '8.0' | |
alpine-version: '3.18' | |
- php-version: '8.0' | |
alpine-version: 'edge' | |
max-parallel: 16 | |
fail-fast: false | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Fetch the PHP BUILD VERSION | |
id: fetch-php-build-version | |
shell: php {0} | |
run: | | |
<?php | |
$alpineVersion = getenv('ALPINE_VERSION'); | |
$phpVersion = getenv('PHP_VERSION'); | |
$version = match($phpVersion){ | |
'8.1' => '81', | |
'8.2' => '82', | |
default => substr($phpVersion, 0, 1) | |
}; | |
echo "::set-output name=version::" . $version . PHP_EOL; | |
- name: Build | |
run: export PHP_BUILD_VERSION=${{ steps.fetch-php-build-version.outputs.version }} && docker-compose build alpine-swoole | |
- name: Push Images to Docker Hub | |
if: ${{ github.ref == 'refs/heads/build' }} | |
run: ./.github/workflows/push.sh | |
- name: Push the latest images | |
if: ${{ github.ref == 'refs/heads/build' && matrix.php-version == '8.2' && matrix.alpine-version == '3.18' }} | |
run: | | |
docker push hyperf/hyperf:latest | |
docker push ghcr.io/hyperf/hyperf-docker/hyperf:latest | |