From 72ff19ff5f7a96a90473d02581520f4d6bbfb82b Mon Sep 17 00:00:00 2001 From: Jon Date: Sat, 10 Aug 2024 14:54:14 +0930 Subject: [PATCH] fix: ensure dev branch publishes image https://github.com/nofusscomputing/centurion_erp/pull/217 https://github.com/nofusscomputing/centurion_erp/issues/214 --- .github/workflows/docker.yaml | 49 +++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index 1555c00..0514a04 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -668,7 +668,11 @@ jobs: docker-publish: - if: ${{ github.ref_type == 'tag' }} + if: ${{( + github.ref_type == 'tag' + || + github.ref_name == 'development' + )}} needs: - docker-build - docker-scan-vulnerability @@ -688,11 +692,32 @@ jobs: - name: Tag Image with GIT Tag '${{ github.ref_name }}' + if: ${{ github.ref_type == 'tag' }} run: | docker buildx imagetools create ${{ inputs.DOCKER_BUILD_REGISTRY }}/${{ inputs.DOCKER_BUILD_IMAGE_NAME }}:${{ inputs.DOCKER_TAG_IMAGE_TAG_SOURCE }} \ --tag ${{ inputs.DOCKER_PUBLISH_REGISTRY }}/${{ inputs.DOCKER_PUBLISH_IMAGE_NAME }}:${{ github.ref_name }} \ + - name: Tag Image with GIT 'latest' + if: ${{ inputs.DOCKER_TAG_IMAGE_TAG_LATEST }} + id: tag-image + shell: bash + run: | + TAG_NAME=dev; + + if [ "${{ github.ref_name }}" == 'master' ]; then + + TAG_NAME=latest; + + fi + + echo "[Debug] TAG_NAME=${TAG_NAME}"; + + echo "mutable_tag_name=${TAG_NAME}" > $GITHUB_OUTPUT + + docker buildx imagetools create ${{ inputs.DOCKER_BUILD_REGISTRY }}/${{ inputs.DOCKER_BUILD_IMAGE_NAME }}:${{ inputs.DOCKER_TAG_IMAGE_TAG_SOURCE }} \ + --tag ${{ inputs.DOCKER_PUBLISH_REGISTRY }}/${{ inputs.DOCKER_PUBLISH_IMAGE_NAME }}:${TAG_NAME}; + - name: Tag Image with GIT commit '${{ inputs.DOCKER_TAG_IMAGE_TAG_SOURCE }}' if: ${{ inputs.DOCKER_TAG_IMAGE_TAG_SHA }} @@ -751,28 +776,6 @@ jobs: path: ${{ steps.sbom-attest.outputs.bundle-path }} - - - name: Tag Image with GIT 'latest' - if: ${{ inputs.DOCKER_TAG_IMAGE_TAG_LATEST }} - id: tag-image - shell: bash - run: | - TAG_NAME=dev; - - if [ "${{ github.ref_name }}" == 'master' ]; then - - TAG_NAME=latest; - - fi - - echo "[Debug] TAG_NAME=${TAG_NAME}"; - - echo "mutable_tag_name=${TAG_NAME}" > $GITHUB_OUTPUT - - docker buildx imagetools create ${{ inputs.DOCKER_BUILD_REGISTRY }}/${{ inputs.DOCKER_BUILD_IMAGE_NAME }}:${{ inputs.DOCKER_TAG_IMAGE_TAG_SOURCE }} \ - --tag ${{ inputs.DOCKER_PUBLISH_REGISTRY }}/${{ inputs.DOCKER_PUBLISH_IMAGE_NAME }}:${TAG_NAME}; - - - name: Append GH Release Body if: ${{ github.ref_type == 'tag' }} id: release