From e9b19ea54a67ffb6b077cc5bd9d31ecc007aaf18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=B6ller?= <am@localheinz.com> Date: Mon, 12 Feb 2024 21:25:57 +0100 Subject: [PATCH] Enhancement: Determine composer version once --- .github/workflows/v1.yaml | 53 ++++++++++++++++------------- .github/workflows/v2-current.yaml | 54 +++++++++++++++++------------- .github/workflows/v2-lts.yaml | 38 ++++++++++++--------- .github/workflows/v2-previous.yaml | 38 ++++++++++++--------- 4 files changed, 103 insertions(+), 80 deletions(-) diff --git a/.github/workflows/v1.yaml b/.github/workflows/v1.yaml index 7479098..11a2a70 100644 --- a/.github/workflows/v1.yaml +++ b/.github/workflows/v1.yaml @@ -21,6 +21,11 @@ jobs: working-directory: '1.10' steps: - uses: actions/checkout@v4 + - name: Determine composer version from Dockerfile + run: | + echo "COMPOSER_VERSION_MAJOR=$(grep -oP 'COMPOSER_VERSION \d+\.\d+\.\d+' Dockerfile | sed '/COMPOSER_VERSION /s///' | grep -oP '^\d+')" >> $GITHUB_ENV + echo "COMPOSER_VERSION_MAJOR_MINOR=$(grep -oP 'COMPOSER_VERSION \d+\.\d+\.\d+' Dockerfile | sed '/COMPOSER_VERSION /s///' | grep -oP '^\d+\.\d+')" >> $GITHUB_ENV + echo "COMPOSER_VERSION_MAJOR_MINOR_PATCH=$(grep -oP 'COMPOSER_VERSION \d+\.\d+\.\d+' Dockerfile | sed '/COMPOSER_VERSION /s///')" >> $GITHUB_ENV # Build full image: binary with runtime - name: Build full image run: | @@ -28,9 +33,9 @@ jobs: --pull \ --no-cache \ --target binary-with-runtime \ - --tag composer/composer:1 \ - --tag composer/composer:1.10 \ - --tag composer/composer:$(grep -oP 'COMPOSER_VERSION 1.10.\d+' Dockerfile | grep -oP '1.10.\d+') \ + --tag composer/composer:${{ env.COMPOSER_VERSION_MAJOR }} \ + --tag composer/composer:${{ env.COMPOSER_VERSION_MAJOR_MINOR }} \ + --tag composer/composer:${{ env.COMPOSER_VERSION_MAJOR_MINOR_PATCH }} \ . # Build low-size image with binary only - name: Build binary-only image @@ -39,9 +44,9 @@ jobs: --pull \ --no-cache \ --target standalone-binary \ - --tag composer/composer:1-bin \ - --tag composer/composer:1.10-bin \ - --tag composer/composer:$(grep -oP 'COMPOSER_VERSION 1.10.\d+' Dockerfile | grep -oP '1.10.\d+')-bin \ + --tag composer/composer:${{ env.COMPOSER_VERSION_MAJOR }}-bin \ + --tag composer/composer:${{ env.COMPOSER_VERSION_MAJOR_MINOR }}-bin \ + --tag composer/composer:${{ env.COMPOSER_VERSION_MAJOR_MINOR_PATCH }}-bin \ . - name: Login to Docker Hub if: github.ref == 'refs/heads/main' @@ -52,12 +57,12 @@ jobs: - name: Push tag(s) to Docker Hub if: github.ref == 'refs/heads/main' run: | - docker push composer/composer:1 - docker push composer/composer:1-bin - docker push composer/composer:1.10 - docker push composer/composer:1.10-bin - docker push composer/composer:$(grep -oP 'COMPOSER_VERSION 1.10.\d+' Dockerfile | grep -oP '1.10.\d+') - docker push composer/composer:$(grep -oP 'COMPOSER_VERSION 1.10.\d+' Dockerfile | grep -oP '1.10.\d+')-bin + docker push composer/composer:${{ env.COMPOSER_VERSION_MAJOR }} + docker push composer/composer:${{ env.COMPOSER_VERSION_MAJOR }}-bin + docker push composer/composer:${{ env.COMPOSER_VERSION_MAJOR_MINOR }} + docker push composer/composer:${{ env.COMPOSER_VERSION_MAJOR_MINOR }}-bin + docker push composer/composer:${{ env.COMPOSER_VERSION_MAJOR_MINOR_PATCH }} + docker push composer/composer:${{ env.COMPOSER_VERSION_MAJOR_MINOR_PATCH }}-bin - name: Login to Amazon Public ECR if: github.ref == 'refs/heads/main' uses: docker/login-action@v3 @@ -68,15 +73,15 @@ jobs: - name: Push tag(s) to Amazon Public ECR if: github.ref == 'refs/heads/main' run: | - docker tag composer/composer:1 ${{ env.ECR_REPO }}:1 - docker tag composer/composer:1-bin ${{ env.ECR_REPO }}:1-bin - docker tag composer/composer:1.10 ${{ env.ECR_REPO }}:1.10 - docker tag composer/composer:1.10-bin ${{ env.ECR_REPO }}:1.10-bin - docker tag composer/composer:$(grep -oP 'COMPOSER_VERSION 1.10.\d+' Dockerfile | grep -oP '1.10.\d+') ${{ env.ECR_REPO }}:$(grep -oP 'COMPOSER_VERSION 1.10.\d+' Dockerfile | grep -oP '1.10.\d+') - docker tag composer/composer:$(grep -oP 'COMPOSER_VERSION 1.10.\d+' Dockerfile | grep -oP '1.10.\d+')-bin ${{ env.ECR_REPO }}:$(grep -oP 'COMPOSER_VERSION 1.10.\d+' Dockerfile | grep -oP '1.10.\d+')-bin - docker push ${{ env.ECR_REPO }}:1 - docker push ${{ env.ECR_REPO }}:1-bin - docker push ${{ env.ECR_REPO }}:1.10 - docker push ${{ env.ECR_REPO }}:1.10-bin - docker push ${{ env.ECR_REPO }}:$(grep -oP 'COMPOSER_VERSION 1.10.\d+' Dockerfile | grep -oP '1.10.\d+') - docker push ${{ env.ECR_REPO }}:$(grep -oP 'COMPOSER_VERSION 1.10.\d+' Dockerfile | grep -oP '1.10.\d+')-bin + docker tag composer/composer:${{ env.COMPOSER_VERSION_MAJOR }} ${{ env.ECR_REPO }}:${{ env.COMPOSER_VERSION_MAJOR }} + docker tag composer/composer:${{ env.COMPOSER_VERSION_MAJOR }}-bin ${{ env.ECR_REPO }}:${{ env.COMPOSER_VERSION_MAJOR }}-bin + docker tag composer/composer:${{ env.COMPOSER_VERSION_MAJOR_MINOR }} ${{ env.ECR_REPO }}:${{ env.COMPOSER_VERSION_MAJOR_MINOR }} + docker tag composer/composer:${{ env.COMPOSER_VERSION_MAJOR_MINOR }}-bin ${{ env.ECR_REPO }}:${{ env.COMPOSER_VERSION_MAJOR_MINOR }}-bin + docker tag composer/composer:${{ env.COMPOSER_VERSION_MAJOR_MINOR_PATCH }} ${{ env.ECR_REPO }}:${{ env.COMPOSER_VERSION_MAJOR_MINOR_PATCH }} + docker tag composer/composer:${{ env.COMPOSER_VERSION_MAJOR_MINOR_PATCH }}-bin ${{ env.ECR_REPO }}:${{ env.COMPOSER_VERSION_MAJOR_MINOR_PATCH }}-bin + docker push ${{ env.ECR_REPO }}:${{ env.COMPOSER_VERSION_MAJOR }} + docker push ${{ env.ECR_REPO }}:${{ env.COMPOSER_VERSION_MAJOR }}-bin + docker push ${{ env.ECR_REPO }}:${{ env.COMPOSER_VERSION_MAJOR_MINOR }} + docker push ${{ env.ECR_REPO }}:${{ env.COMPOSER_VERSION_MAJOR_MINOR }}-bin + docker push ${{ env.ECR_REPO }}:${{ env.COMPOSER_VERSION_MAJOR_MINOR_PATCH }} + docker push ${{ env.ECR_REPO }}:${{ env.COMPOSER_VERSION_MAJOR_MINOR_PATCH }}-bin diff --git a/.github/workflows/v2-current.yaml b/.github/workflows/v2-current.yaml index 2ce7102..45aecbc 100644 --- a/.github/workflows/v2-current.yaml +++ b/.github/workflows/v2-current.yaml @@ -22,6 +22,12 @@ jobs: - "2.7" steps: - uses: actions/checkout@v4 + - name: Determine composer version from Dockerfile + working-directory: ${{ matrix.version }} + run: | + echo "COMPOSER_VERSION_MAJOR=$(grep -oP 'COMPOSER_VERSION \d+\.\d+\.\d+' Dockerfile | sed '/COMPOSER_VERSION /s///' | grep -oP '^\d+')" >> $GITHUB_ENV + echo "COMPOSER_VERSION_MAJOR_MINOR=$(grep -oP 'COMPOSER_VERSION \d+\.\d+\.\d+' Dockerfile | sed '/COMPOSER_VERSION /s///' | grep -oP '^\d+\.\d+')" >> $GITHUB_ENV + echo "COMPOSER_VERSION_MAJOR_MINOR_PATCH=$(grep -oP 'COMPOSER_VERSION \d+\.\d+\.\d+' Dockerfile | sed '/COMPOSER_VERSION /s///')" >> $GITHUB_ENV # Build full image: binary with runtime - name: Build full image working-directory: ${{ matrix.version }} @@ -31,9 +37,9 @@ jobs: --no-cache \ --target binary-with-runtime \ --tag composer/composer:latest \ - --tag composer/composer:2 \ - --tag composer/composer:${{ matrix.version }} \ - --tag composer/composer:$(grep -oP 'COMPOSER_VERSION ${{ matrix.version }}.\d+' Dockerfile | grep -oP '${{ matrix.version }}.\d+') \ + --tag composer/composer:${{ env.COMPOSER_VERSION_MAJOR }} \ + --tag composer/composer:${{ env.COMPOSER_VERSION_MAJOR_MINOR }} \ + --tag composer/composer:${{ env.COMPOSER_VERSION_MAJOR_MINOR_PATCH }} \ . # Build low-size image with binary only - name: Build binary-only image @@ -44,9 +50,9 @@ jobs: --no-cache \ --target standalone-binary \ --tag composer/composer:latest-bin \ - --tag composer/composer:2-bin \ - --tag composer/composer:${{ matrix.version }}-bin \ - --tag composer/composer:$(grep -oP 'COMPOSER_VERSION ${{ matrix.version }}.\d+' Dockerfile | grep -oP '${{ matrix.version }}.\d+')-bin \ + --tag composer/composer:${{ env.COMPOSER_VERSION_MAJOR }}-bin \ + --tag composer/composer:${{ env.COMPOSER_VERSION_MAJOR_MINOR }}-bin \ + --tag composer/composer:${{ env.COMPOSER_VERSION_MAJOR_MINOR_PATCH }}-bin \ . - name: Login to Docker Hub if: github.ref == 'refs/heads/main' @@ -60,12 +66,12 @@ jobs: run: | docker push composer/composer:latest docker push composer/composer:latest-bin - docker push composer/composer:2 - docker push composer/composer:2-bin - docker push composer/composer:${{ matrix.version }} - docker push composer/composer:${{ matrix.version }}-bin - docker push composer/composer:$(grep -oP 'COMPOSER_VERSION ${{ matrix.version }}.\d+' Dockerfile | grep -oP '${{ matrix.version }}.\d+') - docker push composer/composer:$(grep -oP 'COMPOSER_VERSION ${{ matrix.version }}.\d+' Dockerfile | grep -oP '${{ matrix.version }}.\d+')-bin + docker push composer/composer:${{ env.COMPOSER_VERSION_MAJOR }} + docker push composer/composer:${{ env.COMPOSER_VERSION_MAJOR }}-bin + docker push composer/composer:${{ env.COMPOSER_VERSION_MAJOR_MINOR }} + docker push composer/composer:${{ env.COMPOSER_VERSION_MAJOR_MINOR }}-bin + docker push composer/composer:${{ env.COMPOSER_VERSION_MAJOR_MINOR_PATCH }} + docker push composer/composer:${{ env.COMPOSER_VERSION_MAJOR_MINOR_PATCH }}-bin - name: Login to Amazon Public ECR if: github.ref == 'refs/heads/main' uses: docker/login-action@v3 @@ -79,17 +85,17 @@ jobs: run: | docker tag composer/composer:latest ${{ env.ECR_REPO }}:latest docker tag composer/composer:latest-bin ${{ env.ECR_REPO }}:latest-bin - docker tag composer/composer:2 ${{ env.ECR_REPO }}:2 - docker tag composer/composer:2-bin ${{ env.ECR_REPO }}:2-bin - docker tag composer/composer:${{ matrix.version }} ${{ env.ECR_REPO }}:${{ matrix.version }} - docker tag composer/composer:${{ matrix.version }}-bin ${{ env.ECR_REPO }}:${{ matrix.version }}-bin - docker tag composer/composer:$(grep -oP 'COMPOSER_VERSION ${{ matrix.version }}.\d+' Dockerfile | grep -oP '${{ matrix.version }}.\d+') ${{ env.ECR_REPO }}:$(grep -oP 'COMPOSER_VERSION ${{ matrix.version }}.\d+' Dockerfile | grep -oP '${{ matrix.version }}.\d+') - docker tag composer/composer:$(grep -oP 'COMPOSER_VERSION ${{ matrix.version }}.\d+' Dockerfile | grep -oP '${{ matrix.version }}.\d+') ${{ env.ECR_REPO }}:$(grep -oP 'COMPOSER_VERSION ${{ matrix.version }}.\d+' Dockerfile | grep -oP '${{ matrix.version }}.\d+')-bin + docker tag composer/composer:${{ env.COMPOSER_VERSION_MAJOR }} ${{ env.ECR_REPO }}:${{ env.COMPOSER_VERSION_MAJOR }} + docker tag composer/composer:${{ env.COMPOSER_VERSION_MAJOR }}-bin ${{ env.ECR_REPO }}:${{ env.COMPOSER_VERSION_MAJOR }}-bin + docker tag composer/composer:${{ env.COMPOSER_VERSION_MAJOR_MINOR }} ${{ env.ECR_REPO }}:${{ env.COMPOSER_VERSION_MAJOR_MINOR }} + docker tag composer/composer:${{ env.COMPOSER_VERSION_MAJOR_MINOR }}-bin ${{ env.ECR_REPO }}:${{ env.COMPOSER_VERSION_MAJOR_MINOR }}-bin + docker tag composer/composer:${{ env.COMPOSER_VERSION_MAJOR_MINOR_PATCH }} ${{ env.ECR_REPO }}:${{ env.COMPOSER_VERSION_MAJOR_MINOR_PATCH }} + docker tag composer/composer:${{ env.COMPOSER_VERSION_MAJOR_MINOR_PATCH }}-bin ${{ env.ECR_REPO }}:${{ env.COMPOSER_VERSION_MAJOR_MINOR_PATCH }}-bin docker push ${{ env.ECR_REPO }}:latest docker push ${{ env.ECR_REPO }}:latest-bin - docker push ${{ env.ECR_REPO }}:2 - docker push ${{ env.ECR_REPO }}:2-bin - docker push ${{ env.ECR_REPO }}:${{ matrix.version }} - docker push ${{ env.ECR_REPO }}:${{ matrix.version }}-bin - docker push ${{ env.ECR_REPO }}:$(grep -oP 'COMPOSER_VERSION ${{ matrix.version }}.\d+' Dockerfile | grep -oP '${{ matrix.version }}.\d+') - docker push ${{ env.ECR_REPO }}:$(grep -oP 'COMPOSER_VERSION ${{ matrix.version }}.\d+' Dockerfile | grep -oP '${{ matrix.version }}.\d+')-bin + docker push ${{ env.ECR_REPO }}:${{ env.COMPOSER_VERSION_MAJOR }} + docker push ${{ env.ECR_REPO }}:${{ env.COMPOSER_VERSION_MAJOR }}-bin + docker push ${{ env.ECR_REPO }}:${{ env.COMPOSER_VERSION_MAJOR_MINOR }} + docker push ${{ env.ECR_REPO }}:${{ env.COMPOSER_VERSION_MAJOR_MINOR }}-bin + docker push ${{ env.ECR_REPO }}:${{ env.COMPOSER_VERSION_MAJOR_MINOR_PATCH }} + docker push ${{ env.ECR_REPO }}:${{ env.COMPOSER_VERSION_MAJOR_MINOR_PATCH }}-bin diff --git a/.github/workflows/v2-lts.yaml b/.github/workflows/v2-lts.yaml index c82a62a..1dc4cde 100644 --- a/.github/workflows/v2-lts.yaml +++ b/.github/workflows/v2-lts.yaml @@ -22,6 +22,12 @@ jobs: - "2.2" steps: - uses: actions/checkout@v4 + - name: Determine composer version from Dockerfile + working-directory: ${{ matrix.version }} + run: | + echo "COMPOSER_VERSION_MAJOR=$(grep -oP 'COMPOSER_VERSION \d+\.\d+\.\d+' Dockerfile | sed '/COMPOSER_VERSION /s///' | grep -oP '^\d+')" >> $GITHUB_ENV + echo "COMPOSER_VERSION_MAJOR_MINOR=$(grep -oP 'COMPOSER_VERSION \d+\.\d+\.\d+' Dockerfile | sed '/COMPOSER_VERSION /s///' | grep -oP '^\d+\.\d+')" >> $GITHUB_ENV + echo "COMPOSER_VERSION_MAJOR_MINOR_PATCH=$(grep -oP 'COMPOSER_VERSION \d+\.\d+\.\d+' Dockerfile | sed '/COMPOSER_VERSION /s///')" >> $GITHUB_ENV # Build full image: binary with runtime - name: Build full image working-directory: ${{ matrix.version }} @@ -31,8 +37,8 @@ jobs: --no-cache \ --target binary-with-runtime \ --tag composer/composer:lts \ - --tag composer/composer:${{ matrix.version }} \ - --tag composer/composer:$(grep -oP 'COMPOSER_VERSION ${{ matrix.version }}.\d+' Dockerfile | grep -oP '${{ matrix.version }}.\d+') \ + --tag composer/composer:${{ env.COMPOSER_VERSION_MAJOR_MINOR }} \ + --tag composer/composer:${{ env.COMPOSER_VERSION_MAJOR_MINOR_PATCH }} \ . # Build low-size image with binary only - name: Build binary-only image @@ -43,8 +49,8 @@ jobs: --no-cache \ --target standalone-binary \ --tag composer/composer:lts-bin \ - --tag composer/composer:${{ matrix.version }}-bin \ - --tag composer/composer:$(grep -oP 'COMPOSER_VERSION ${{ matrix.version }}.\d+' Dockerfile | grep -oP '${{ matrix.version }}.\d+')-bin \ + --tag composer/composer:${{ env.COMPOSER_VERSION_MAJOR_MINOR }}-bin \ + --tag composer/composer:${{ env.COMPOSER_VERSION_MAJOR_MINOR_PATCH }}-bin \ . - name: Login to Docker Hub if: github.ref == 'refs/heads/main' @@ -58,10 +64,10 @@ jobs: run: | docker push composer/composer:lts docker push composer/composer:lts-bin - docker push composer/composer:${{ matrix.version }} - docker push composer/composer:${{ matrix.version }}-bin - docker push composer/composer:$(grep -oP 'COMPOSER_VERSION ${{ matrix.version }}.\d+' Dockerfile | grep -oP '${{ matrix.version }}.\d+') - docker push composer/composer:$(grep -oP 'COMPOSER_VERSION ${{ matrix.version }}.\d+' Dockerfile | grep -oP '${{ matrix.version }}.\d+')-bin + docker push composer/composer:${{ env.COMPOSER_VERSION_MAJOR_MINOR }} + docker push composer/composer:${{ env.COMPOSER_VERSION_MAJOR_MINOR }}-bin + docker push composer/composer:${{ env.COMPOSER_VERSION_MAJOR_MINOR_PATCH }} + docker push composer/composer:${{ env.COMPOSER_VERSION_MAJOR_MINOR_PATCH }}-bin - name: Login to Amazon Public ECR if: github.ref == 'refs/heads/main' uses: docker/login-action@v3 @@ -75,13 +81,13 @@ jobs: run: | docker tag composer/composer:lts ${{ env.ECR_REPO }}:lts docker tag composer/composer:lts-bin ${{ env.ECR_REPO }}:lts-bin - docker tag composer/composer:${{ matrix.version }} ${{ env.ECR_REPO }}:${{ matrix.version }} - docker tag composer/composer:${{ matrix.version }}-bin ${{ env.ECR_REPO }}:${{ matrix.version }}-bin - docker tag composer/composer:$(grep -oP 'COMPOSER_VERSION ${{ matrix.version }}.\d+' Dockerfile | grep -oP '${{ matrix.version }}.\d+') ${{ env.ECR_REPO }}:$(grep -oP 'COMPOSER_VERSION ${{ matrix.version }}.\d+' Dockerfile | grep -oP '${{ matrix.version }}.\d+') - docker tag composer/composer:$(grep -oP 'COMPOSER_VERSION ${{ matrix.version }}.\d+' Dockerfile | grep -oP '${{ matrix.version }}.\d+')-bin ${{ env.ECR_REPO }}:$(grep -oP 'COMPOSER_VERSION ${{ matrix.version }}.\d+' Dockerfile | grep -oP '${{ matrix.version }}.\d+')-bin + docker tag composer/composer:${{ env.COMPOSER_VERSION_MAJOR_MINOR }} ${{ env.ECR_REPO }}:${{ env.COMPOSER_VERSION_MAJOR_MINOR }} + docker tag composer/composer:${{ env.COMPOSER_VERSION_MAJOR_MINOR }}-bin ${{ env.ECR_REPO }}:${{ env.COMPOSER_VERSION_MAJOR_MINOR }}-bin + docker tag composer/composer:${{ env.COMPOSER_VERSION_MAJOR_MINOR_PATCH }} ${{ env.ECR_REPO }}:${{ env.COMPOSER_VERSION_MAJOR_MINOR_PATCH }} + docker tag composer/composer:${{ env.COMPOSER_VERSION_MAJOR_MINOR_PATCH }}-bin ${{ env.ECR_REPO }}:${{ env.COMPOSER_VERSION_MAJOR_MINOR_PATCH }}-bin docker push ${{ env.ECR_REPO }}:lts docker push ${{ env.ECR_REPO }}:lts-bin - docker push ${{ env.ECR_REPO }}:${{ matrix.version }} - docker push ${{ env.ECR_REPO }}:${{ matrix.version }}-bin - docker push ${{ env.ECR_REPO }}:$(grep -oP 'COMPOSER_VERSION ${{ matrix.version }}.\d+' Dockerfile | grep -oP '${{ matrix.version }}.\d+') - docker push ${{ env.ECR_REPO }}:$(grep -oP 'COMPOSER_VERSION ${{ matrix.version }}.\d+' Dockerfile | grep -oP '${{ matrix.version }}.\d+')-bin + docker push ${{ env.ECR_REPO }}:${{ env.COMPOSER_VERSION_MAJOR_MINOR }} + docker push ${{ env.ECR_REPO }}:${{ env.COMPOSER_VERSION_MAJOR_MINOR }}-bin + docker push ${{ env.ECR_REPO }}:${{ env.COMPOSER_VERSION_MAJOR_MINOR_PATCH }} + docker push ${{ env.ECR_REPO }}:${{ env.COMPOSER_VERSION_MAJOR_MINOR_PATCH }}-bin diff --git a/.github/workflows/v2-previous.yaml b/.github/workflows/v2-previous.yaml index 9c43acb..0ed993b 100644 --- a/.github/workflows/v2-previous.yaml +++ b/.github/workflows/v2-previous.yaml @@ -29,6 +29,12 @@ jobs: - "2.6" steps: - uses: actions/checkout@v4 + - name: Determine composer version from Dockerfile + working-directory: ${{ matrix.version }} + run: | + echo "COMPOSER_VERSION_MAJOR=$(grep -oP 'COMPOSER_VERSION \d+\.\d+\.\d+' Dockerfile | sed '/COMPOSER_VERSION /s///' | grep -oP '^\d+')" >> $GITHUB_ENV + echo "COMPOSER_VERSION_MAJOR_MINOR=$(grep -oP 'COMPOSER_VERSION \d+\.\d+\.\d+' Dockerfile | sed '/COMPOSER_VERSION /s///' | grep -oP '^\d+\.\d+')" >> $GITHUB_ENV + echo "COMPOSER_VERSION_MAJOR_MINOR_PATCH=$(grep -oP 'COMPOSER_VERSION \d+\.\d+\.\d+' Dockerfile | sed '/COMPOSER_VERSION /s///')" >> $GITHUB_ENV # Build full image: binary with runtime - name: Build full image working-directory: ${{ matrix.version }} @@ -37,8 +43,8 @@ jobs: --pull \ --no-cache \ --target binary-with-runtime \ - --tag composer/composer:${{ matrix.version }} \ - --tag composer/composer:$(grep -oP 'COMPOSER_VERSION ${{ matrix.version }}.\d+' Dockerfile | grep -oP '${{ matrix.version }}.\d+') \ + --tag composer/composer:${{ env.COMPOSER_VERSION_MAJOR_MINOR }} \ + --tag composer/composer:${{ env.COMPOSER_VERSION_MAJOR_MINOR_PATCH }} \ . # Build low-size image with binary only - name: Build binary-only image @@ -48,8 +54,8 @@ jobs: --pull \ --no-cache \ --target standalone-binary \ - --tag composer/composer:${{ matrix.version }}-bin \ - --tag composer/composer:$(grep -oP 'COMPOSER_VERSION ${{ matrix.version }}.\d+' Dockerfile | grep -oP '${{ matrix.version }}.\d+')-bin \ + --tag composer/composer:${{ env.COMPOSER_VERSION_MAJOR_MINOR }}-bin \ + --tag composer/composer:${{ env.COMPOSER_VERSION_MAJOR_MINOR_PATCH }}-bin \ . - name: Login to Docker Hub if: github.ref == 'refs/heads/main' @@ -61,10 +67,10 @@ jobs: if: github.ref == 'refs/heads/main' working-directory: ${{ matrix.version }} run: | - docker push composer/composer:${{ matrix.version }} - docker push composer/composer:${{ matrix.version }}-bin - docker push composer/composer:$(grep -oP 'COMPOSER_VERSION ${{ matrix.version }}.\d+' Dockerfile | grep -oP '${{ matrix.version }}.\d+') - docker push composer/composer:$(grep -oP 'COMPOSER_VERSION ${{ matrix.version }}.\d+' Dockerfile | grep -oP '${{ matrix.version }}.\d+')-bin + docker push composer/composer:${{ env.COMPOSER_VERSION_MAJOR_MINOR }} + docker push composer/composer:${{ env.COMPOSER_VERSION_MAJOR_MINOR }}-bin + docker push composer/composer:${{ env.COMPOSER_VERSION_MAJOR_MINOR_PATCH }} + docker push composer/composer:${{ env.COMPOSER_VERSION_MAJOR_MINOR_PATCH }}-bin - name: Login to Amazon Public ECR if: github.ref == 'refs/heads/main' uses: docker/login-action@v3 @@ -76,11 +82,11 @@ jobs: if: github.ref == 'refs/heads/main' working-directory: ${{ matrix.version }} run: | - docker tag composer/composer:${{ matrix.version }} ${{ env.ECR_REPO }}:${{ matrix.version }} - docker tag composer/composer:${{ matrix.version }}-bin ${{ env.ECR_REPO }}:${{ matrix.version }}-bin - docker tag composer/composer:$(grep -oP 'COMPOSER_VERSION ${{ matrix.version }}.\d+' Dockerfile | grep -oP '${{ matrix.version }}.\d+') ${{ env.ECR_REPO }}:$(grep -oP 'COMPOSER_VERSION ${{ matrix.version }}.\d+' Dockerfile | grep -oP '${{ matrix.version }}.\d+') - docker tag composer/composer:$(grep -oP 'COMPOSER_VERSION ${{ matrix.version }}.\d+' Dockerfile | grep -oP '${{ matrix.version }}.\d+')-bin ${{ env.ECR_REPO }}:$(grep -oP 'COMPOSER_VERSION ${{ matrix.version }}.\d+' Dockerfile | grep -oP '${{ matrix.version }}.\d+')-bin - docker push ${{ env.ECR_REPO }}:${{ matrix.version }} - docker push ${{ env.ECR_REPO }}:${{ matrix.version }}-bin - docker push ${{ env.ECR_REPO }}:$(grep -oP 'COMPOSER_VERSION ${{ matrix.version }}.\d+' Dockerfile | grep -oP '${{ matrix.version }}.\d+') - docker push ${{ env.ECR_REPO }}:$(grep -oP 'COMPOSER_VERSION ${{ matrix.version }}.\d+' Dockerfile | grep -oP '${{ matrix.version }}.\d+')-bin + docker tag composer/composer:${{ env.COMPOSER_VERSION_MAJOR_MINOR }} ${{ env.ECR_REPO }}:${{ env.COMPOSER_VERSION_MAJOR_MINOR }} + docker tag composer/composer:${{ env.COMPOSER_VERSION_MAJOR_MINOR }}-bin ${{ env.ECR_REPO }}:${{ env.COMPOSER_VERSION_MAJOR_MINOR }}-bin + docker tag composer/composer:${{ env.COMPOSER_VERSION_MAJOR_MINOR_PATCH }} ${{ env.ECR_REPO }}:${{ env.COMPOSER_VERSION_MAJOR_MINOR_PATCH }} + docker tag composer/composer:${{ env.COMPOSER_VERSION_MAJOR_MINOR_PATCH }}-bin ${{ env.ECR_REPO }}:${{ env.COMPOSER_VERSION_MAJOR_MINOR_PATCH }}-bin + docker push ${{ env.ECR_REPO }}:${{ env.COMPOSER_VERSION_MAJOR_MINOR }} + docker push ${{ env.ECR_REPO }}:${{ env.COMPOSER_VERSION_MAJOR_MINOR }}-bin + docker push ${{ env.ECR_REPO }}:${{ env.COMPOSER_VERSION_MAJOR_MINOR_PATCH }} + docker push ${{ env.ECR_REPO }}:${{ env.COMPOSER_VERSION_MAJOR_MINOR_PATCH }}-bin