diff --git a/.github/workflows/build-stable.yml b/.github/workflows/build-stable.yml index bb5b1d1..f1bbe5e 100644 --- a/.github/workflows/build-stable.yml +++ b/.github/workflows/build-stable.yml @@ -16,8 +16,8 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - edition: ["", "-ee", "-de"] images: ["documentserver-stable"] + edition: ["", "-ee", "-de"] steps: - name: Checkout code uses: actions/checkout@v3 @@ -41,18 +41,23 @@ jobs: - name: Build documentserver-stable run: | - DOCKER_TAG=$(echo ${{ steps.tag_name.outputs.SOURCE_TAG }} | sed 's/^.//; s/-stable//') - IMAGE_STATUS=$(docker manifest inspect ${{ env.COMPANY_NAME }}/4testing-${{ env.PRODUCT_NAME }}${{ matrix.edition }}:$DOCKER_TAG > /dev/null ; echo $?) + TAG=$(echo ${{ steps.tag_name.outputs.SOURCE_TAG }} | sed 's/^.//; s/-stable//') + SHORTER_TAG=$(echo ${TAG} | grep -o -P '^[\d]+\.[\d]+\.[\d]+') + SHORTEST_TAG=$(echo ${TAG} | grep -o -P '^[\d]+\.[\d]+') + IMAGE_STATUS=$(docker manifest inspect ${{ env.COMPANY_NAME }}/4testing-${{ env.PRODUCT_NAME }}${{ matrix.edition }}:$TAG > /dev/null ; echo $?) if [[ "$IMAGE_STATUS" = "0" ]]; then echo "Image present on docker.hub >> start build stable version" - echo "FROM ${{ env.COMPANY_NAME }}/4testing-${{ env.PRODUCT_NAME }}${{ matrix.edition }}:$DOCKER_TAG as ${{ env.PRODUCT_NAME }}-stable" >> Dockerfile.stable + echo "FROM ${{ env.COMPANY_NAME }}/4testing-${{ env.PRODUCT_NAME }}${{ matrix.edition }}:$TAG as ${{ env.PRODUCT_NAME }}-stable" >> Dockerfile.stable PRODUCT_EDITION=${{ matrix.edition }} PRODUCT_NAME=${{ env.PRODUCT_NAME }} \ - COMPANY_NAME=${{ env.COMPANY_NAME}} DOCKERFILE=Dockerfile.stable TAG=$DOCKER_TAG \ + COMPANY_NAME=${{ env.COMPANY_NAME}} DOCKERFILE=Dockerfile.stable \ + TAG=$TAG \ + SHORTER_TAG=$SHORTER_TAG \ + SHORTEST_TAG=$SHORTEST_TAG \ docker buildx bake \ -f docker-bake.hcl ${{ matrix.images }} \ --push ; else - echo "FAILED: Image with tag $DOCKER_TAG do not presented on docker.hub >> build will not started >> exit with 0" + echo "FAILED: Image with tag $TAG do not presented on docker.hub >> build will not started >> exit with 0" exit 0 fi shell: bash diff --git a/docker-bake.hcl b/docker-bake.hcl index 9e89642..04ed4a0 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -2,6 +2,14 @@ variable "TAG" { default = "" } +variable "SHORTER_TAG" { + default = "" +} + +variable "SHORTEST_TAG" { + default = "" +} + variable "COMPANY_NAME" { default = "" } @@ -37,7 +45,10 @@ target "documentserver" { target "documentserver-stable" { target = "documentserver-stable" dockerfile= "${DOCKERFILE}" - tags = ["docker.io/${COMPANY_NAME}/${PREFIX_NAME}${PRODUCT_NAME}${PRODUCT_EDITION}:${TAG}", "docker.io/${COMPANY_NAME}/${PREFIX_NAME}${PRODUCT_NAME}${PRODUCT_EDITION}:latest"] + tags = ["docker.io/${COMPANY_NAME}/${PREFIX_NAME}${PRODUCT_NAME}${PRODUCT_EDITION}:${TAG}", + "docker.io/${COMPANY_NAME}/${PREFIX_NAME}${PRODUCT_NAME}${PRODUCT_EDITION}:${SHORTER_TAG}", + "docker.io/${COMPANY_NAME}/${PREFIX_NAME}${PRODUCT_NAME}${PRODUCT_EDITION}:${SHORTEST_TAG}", + "docker.io/${COMPANY_NAME}/${PREFIX_NAME}${PRODUCT_NAME}${PRODUCT_EDITION}:latest"] platforms = ["linux/amd64", "linux/arm64"] args = { "PRODUCT_EDITION": "${PRODUCT_EDITION}"