Files
php-for-dev/.github/workflows/continuous-integration.yml
2024-03-17 14:33:32 +07:00

54 lines
1.6 KiB
YAML

name: continuous integration
on:
workflow_dispatch:
push:
branches:
- master
paths:
- '.github/workflows/**'
- '.env'
- 'v*/**'
jobs:
build:
runs-on: ubuntu-20.04
strategy:
matrix:
php_version: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3']
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to docker hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Read .env file
uses: cardinalby/export-env-action@v2
with:
envFile: '.env'
- name: Build the Docker images ${{ matrix.php_version }}
run: |
docker buildx build --push \
--platform=linux/amd64,linux/arm64 \
--build-arg BUILDKIT_INLINE_CACHE=1 \
--build-arg COMPOSER_VERSION=${{ env.COMPOSER_VERSION }} \
--cache-from="type=registry,ref=dannecron/php-for-dev:${{ matrix.php_version }}.cache,mode=max" \
--cache-to="type=registry,ref=dannecron/php-for-dev:${{ matrix.php_version }}.cache,mode=max" \
--tag=dannecron/php-for-dev:${{ matrix.php_version }} \
$(if test "${{ matrix.php_version }}" = "8.0"; then printf %s '--tag=dannecron/php-for-dev:latest'; fi) \
./v${{ matrix.php_version }}
echo "Done"