name: Build Aphex

on:
  push:
    branches:
      - '**'
    tags:
      - 'v*'

env:
  IMAGE_NAME: ethicaljobs/aphex

jobs:
  build:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        php: ['7.3', '7.4']
    name: Build PHP ${{ matrix.php }} container

    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: Retrieve Docker metadata
        id: meta
        uses: docker/metadata-action@v3
        with:
          images: ethicaljobs/aphex-php${{ matrix.php }}
          tags: |
            type=ref,event=branch
            type=ref,event=pr
            type=semver,pattern=v{{version}}
            type=semver,pattern=v{{major}}
            type=semver,pattern=v{{major}}.{{minor}}
            type=sha,prefix=,format=long

      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v1

      - name: Log in to Docker Hub
        uses: docker/login-action@v1
        with:
          username: ${{ secrets.DOCKER_HUB_USERNAME }}
          password: ${{ secrets.DOCKER_HUB_TOKEN }}

      - name: Build and push container
        uses: docker/build-push-action@v2
        with:
          context: .
          push: true
          build-args: |
            PHP_VERSION=${{ matrix.php }}
          tags: ${{ steps.meta.outputs.tags }}
          labels: ${{ steps.meta.outputs.labels }}
          cache-from: type=inline
          cache-to: type=inline

name: Build Aphex

on:
  push:
    branches:
      - '**'
    tags:
      - 'v*'

env:
  IMAGE_NAME: ethicaljobs/aphex

jobs:
  build:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        php: ['7.3', '7.4']
    name: Build PHP ${{ matrix.php }} container

    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: Retrieve Docker metadata
        id: meta
        uses: docker/metadata-action@v3
        with:
          images: ethicaljobs/aphex-php${{ matrix.php }}
          tags: |
            type=ref,event=branch
            type=ref,event=pr
            type=semver,pattern=v{{version}}
            type=semver,pattern=v{{major}}
            type=semver,pattern=v{{major}}.{{minor}}
            type=sha,prefix=,format=long

      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v1

      - name: Log in to Docker Hub
        uses: docker/login-action@v1
        with:
          username: ${{ secrets.DOCKER_HUB_USERNAME }}
          password: ${{ secrets.DOCKER_HUB_TOKEN }}

      - name: Build and push container
        uses: docker/build-push-action@v2
        with:
          context: .
          push: true
          build-args: |
            PHP_VERSION=${{ matrix.php }}
          tags: ${{ steps.meta.outputs.tags }}
          labels: ${{ steps.meta.outputs.labels }}
          cache-from: type=gha
          cache-to: type=gha,mode=max

Switch to GitHub Actions build caching
Switch to GitHub Actions build caching
