mirror of
https://github.com/Dannecron/php-for-dev.git
synced 2025-12-25 16:12:35 +03:00
62 lines
1.9 KiB
YAML
62 lines
1.9 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']
|
|
steps:
|
|
- name: Check out repository
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Login to docker hub
|
|
uses: actions-hub/docker/login@master
|
|
env:
|
|
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
|
|
DOCKER_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_BUILDKIT=1 docker build --cache-from=dannecron/php-for-dev:${{ matrix.php_version }} \
|
|
--build-arg BUILDKIT_INLINE_CACHE=1 \
|
|
--build-arg COMPOSER_VERSION=${{ env.COMPOSER_VERSION }} \
|
|
--tag=localhost/php-for-dev:${{ matrix.php_version }} \
|
|
./v${{ matrix.php_version }}
|
|
docker run --rm localhost/php-for-dev:${{ matrix.php_version }} php -v
|
|
docker tag localhost/php-for-dev:${{ matrix.php_version }} dannecron/php-for-dev:${{ matrix.php_version }}
|
|
echo "Done"
|
|
|
|
- name: push ${{ matrix.php_version }} image to docker hub
|
|
if: success()
|
|
uses: actions-hub/docker@master
|
|
with:
|
|
args: push dannecron/php-for-dev:${{ matrix.php_version }}
|
|
|
|
- name: tag latest image
|
|
if: success() && matrix.php_version == '7.4'
|
|
uses: actions-hub/docker@master
|
|
with:
|
|
args: tag dannecron/php-for-dev:7.4 dannecron/php-for-dev:latest
|
|
|
|
- name: push latest image to docker hub
|
|
if: success() && matrix.php_version == '7.4'
|
|
uses: actions-hub/docker@master
|
|
with:
|
|
args: push dannecron/php-for-dev:latest
|