From a36662fe72ced0941b973b94be5cbe07b92135e3 Mon Sep 17 00:00:00 2001 From: Houssem Ben Ali Date: Mon, 22 Jan 2024 14:06:41 +0100 Subject: [PATCH] Build Trigger workflow: Apply matrix on master and acceptance branches --- .github/workflows/build.yml | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 40dfd90..3be2a1d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,19 +8,33 @@ env: jobs: trigger-build: runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + - ref: master + tagSuffix: "" + - ref: acceptance + tagSuffix: -acc steps: - name: Checkout uses: actions/checkout@v3 - - name: Update image base + with: + ref: matrix.ref + - name: Update image base for ${{ matrix.ref }} branch run: | latestTag=$(curl -fsSL "https://hub.docker.com/v2/repositories/${{ env.BASE_IMAGE }}/tags/?page_size=1000" | jq -r '.results | .[] | .name' | grep -P '^[0-9]+\.[0-9]+\.[0-9]+$' | head -1) if [ -z "${latestTag}" ]; then echo "Error: Could not get latest tag of ${{ env.BASE_IMAGE }} image! Abort!" exit 1 fi - sed -Ei "s|FROM dbeaver/cloudbeaver.*|FROM dbeaver/cloudbeaver:${latestTag}|g" Dockerfile && git add Dockerfile - git config --global user.email "exo-swf@exoplatform.com" - git config --global user.name "exo-swf" - git commit -m "Bump cloudbeaver version to ${latestTag}" - git tag ${latestTag} -m "Release ${latestTag}" - git push origin HEAD ${latestTag} + sed -Ei "s|FROM dbeaver/cloudbeaver.*|FROM dbeaver/cloudbeaver:${latestTag}{{ matrix.tagSuffix }}|g" Dockerfile && git add Dockerfile + if git diff-index --quiet HEAD; then + echo "Nothing to commit!" + else + git config --global user.email "exo-swf@exoplatform.com" + git config --global user.name "exo-swf" + git commit -m "Bump cloudbeaver version to ${latestTag}{{ matrix.tagSuffix }}" + git tag ${latestTag} -m "Release ${latestTag}{{ matrix.tagSuffix }}" + git push origin HEAD ${latestTag}{{ matrix.tagSuffix }} + fi