| 
 | 1 | +name: Direct build v5 of legacy php  | 
 | 2 | + | 
 | 3 | +on:  | 
 | 4 | +  workflow_dispatch:  | 
 | 5 | + | 
 | 6 | +jobs:  | 
 | 7 | +  test-and-publish:  | 
 | 8 | +    runs-on: ubuntu-latest  | 
 | 9 | +    name: Publish ${{ matrix.php_version }}-${{ matrix.variant }} multi-arch to dockerhub  | 
 | 10 | +    strategy:  | 
 | 11 | +      fail-fast: false  | 
 | 12 | +      matrix:  | 
 | 13 | +        php_version: ['8.1', '8.0', '7.4']  | 
 | 14 | +        variant: ['apache','cli','fpm']  | 
 | 15 | +    steps:  | 
 | 16 | +      - name: Checkout  | 
 | 17 | +        uses: actions/checkout@v4  | 
 | 18 | +      - name: Set up QEMU  | 
 | 19 | +        uses: docker/setup-qemu-action@v3  | 
 | 20 | +      - name: Set up Docker Buildx  | 
 | 21 | +        uses: docker/setup-buildx-action@v3  | 
 | 22 | +      - name: Login to DockerHub  | 
 | 23 | +        uses: docker/login-action@v3  | 
 | 24 | +        with:  | 
 | 25 | +          username: ${{ secrets.DOCKERHUB_USERNAME }}  | 
 | 26 | +          password: ${{ secrets.DOCKERHUB_TOKEN }}  | 
 | 27 | +      - name: Fetch minor version of php  | 
 | 28 | +        run: |  | 
 | 29 | +          # Build slim one  | 
 | 30 | +          PHP_VERSION="${{ matrix.php_version }}"  | 
 | 31 | +          TAG_PREFIX="rc${GITHUB_RUN_ID}-" \  | 
 | 32 | +          docker buildx bake \  | 
 | 33 | +            --set "*.platform=linux/amd64" \  | 
 | 34 | +            --set "*.output=type=docker" \  | 
 | 35 | +            --load \  | 
 | 36 | +            php${PHP_VERSION//.}-slim-${{ matrix.variant }}  | 
 | 37 | +          # Retrieve minor  | 
 | 38 | +          PHP_PATCH_MINOR=`docker run --rm thecodingmachine/php:rc${GITHUB_RUN_ID}-${{ matrix.php_version }}-v5-slim-${{ matrix.variant }} php -v | head -n1 | grep -P '\d+\.\d+\.\d+' -o | head -n1`  | 
 | 39 | +          echo "PHP_PATCH_MINOR=${PHP_PATCH_MINOR}" >> $GITHUB_ENV  | 
 | 40 | +      - name: Display tags to build  | 
 | 41 | +        run: |  | 
 | 42 | +          PHP_VERSION="${{ matrix.php_version }}"  | 
 | 43 | +          PHP_PATCH_MINOR="${{ env.PHP_PATCH_MINOR }}" \  | 
 | 44 | +          TAG_PREFIX="rc${GITHUB_RUN_ID}-" \  | 
 | 45 | +          IS_RELEASE="1" \  | 
 | 46 | +          docker buildx bake php${PHP_VERSION//.}-${{ matrix.variant }}-all --print --progress plain | jq ".target[].tags | join(\" \")" -r > "/tmp/tags.log"  | 
 | 47 | +          cat "/tmp/tags.log"  | 
 | 48 | +      - name: Build and push ${{ matrix.php_version }}-${{ matrix.variant }}  | 
 | 49 | +        run: |  | 
 | 50 | +          PHP_VERSION="${{ matrix.php_version }}"  | 
 | 51 | +          PHP_PATCH_MINOR="${{ env.PHP_PATCH_MINOR }}" \  | 
 | 52 | +          TAG_PREFIX="rc${GITHUB_RUN_ID}-" \  | 
 | 53 | +          IS_RELEASE="1" \  | 
 | 54 | +          docker buildx bake \  | 
 | 55 | +            --set "*.platform=linux/amd64,linux/arm64" \  | 
 | 56 | +            --set "*.output=type=registry" \  | 
 | 57 | +            php${PHP_VERSION//.}-${{ matrix.variant }}-all  | 
 | 58 | +      - name: Push artifacts  | 
 | 59 | +        uses: actions/upload-artifact@v4  | 
 | 60 | +        with:  | 
 | 61 | +          name: ${{ matrix.php_version }}-${{ matrix.variant }}  | 
 | 62 | +          path: /tmp/tags.log  | 
 | 63 | +          retention-days: 60  | 
0 commit comments