From 4dcb67b5f8896a9921a9233cb48e09ed108f4c56 Mon Sep 17 00:00:00 2001 From: Carlos Gomes Date: Tue, 4 Oct 2022 10:33:17 +0200 Subject: [PATCH] Refactor the variables interpolation --- .github/workflows/ci.yml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a962c18..96f6d76 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,6 +7,7 @@ on: workflow_dispatch: env: + LATEST: php8 IMAGE: carlosalgms/composer-and-node-ci jobs: @@ -15,19 +16,21 @@ jobs: strategy: matrix: tag: [php8, php7.1] + image: [carlosalgms/composer-and-node-ci] include: - tag: php8 - image: carlosalgms/composer-and-node-ci + buildArgs: "" - tags: ${{ matrix.image }}:latest,${{ matrix.image }}:${{ matrix.tag }} + # tags: ${{ matrix.image }}:latest,${{ matrix.image }}:${{ matrix.tag }} - tag: php7.1 - image: carlosalgms/composer-and-node-ci buildArgs: | PHP_VERSION=7.1 DEPLOYER_VERSION=v6.6.0 COMPOSER_VERSION=2.2.18 - tags: ${{ matrix.image }}:${{ matrix.tag }} + env: + TAGGED_IMAGE: ${{ matrix.image }}:${{ matrix.tag }} + TAGS: ${{ matrix.tag == env.LATEST && format('{0}:latest,{1}', matrix.image, env.TAGGED_IMAGE) || env.TAGGED_IMAGE}} steps: - uses: actions/checkout@v2 @@ -52,7 +55,7 @@ jobs: pull: true push: true platforms: linux/amd64,linux/arm64,linux/arm/v7 - cache-from: ${{ matrix.image }}:${{ matrix.tag }} + cache-from: ${{ env.TAGGED_IMAGE }} cache-to: type=inline build-args: ${{ matrix.buildArgs }} - tags: ${{ matrix.tags }} + tags: ${{ env.TAGS }}