check matrix jobs #331
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: Docker Image CI | |
on: | |
push: | |
branches: '**' | |
tags: '**' | |
schedule: | |
- cron: 0 0 * * 6 | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
# "5.6", "7.0", "7.1", "7.2", "7.3", | |
php_version: ["7.4", "8.0", "8.1", "8.2", "8.3", "8.4"] | |
continue-on-error: true | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | |
laradock/php-fpm | |
flavor: | | |
suffix=-${{ matrix.php_version }} | |
tags: | | |
type=schedule,pattern={{date 'YYYYMMDD'}} | |
type=ref,event=branch | |
type=semver,pattern={{version}} | |
type=raw,value=latest | |
- 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 | |
if: ${{ (github.repository == 'laradock/php-fpm') && (github.ref == 'refs/heads/master') }} | |
uses: docker/#-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USER }} | |
password: ${{ secrets.DOCKER_HUB_PASSWORD }} | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
file: Dockerfile-${{ matrix.php_version }} | |
# skip linux/arm64 | |
# platforms: linux/amd64,linux/386,linux/arm/v7,linux/arm/v6 | |
platforms: linux/arm64 | |
push: ${{ (github.event_name != 'pull_request') && (github.repository == 'laradock/php-fpm') && (github.ref == 'refs/heads/master') }} | |
tags: ${{ steps.meta.outputs.tags }} | |
final_check: | |
runs-on: ubuntu-latest | |
needs: build | |
if: always() | |
steps: | |
- name: Fail if any matrix job failed | |
run: | | |
if [ "${{ needs.build.result }}" == "failure" ]; then | |
echo "Some matrix jobs failed, marking workflow as failed." | |
exit 1 | |
fi |