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: 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 buildx build --cache-from=dannecron/php-for-dev:${{ matrix.php_version }} \ --platform=linux/amd64,linux/arm64/v8 \ --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 == '8.0' uses: actions-hub/docker@master with: args: tag dannecron/php-for-dev:${{ matrix.php_version }} dannecron/php-for-dev:latest - name: push latest image to docker hub if: success() && matrix.php_version == '8.0' uses: actions-hub/docker@master with: args: push dannecron/php-for-dev:latest