From e55658a0fce1ac645bd8a144c19e77f36bd4a565 Mon Sep 17 00:00:00 2001 From: sandhya1874 Date: Tue, 8 Oct 2024 20:44:06 +0100 Subject: [PATCH] . --- .../build_multiplatform_docker/action.yml | 77 ++++++++----------- 1 file changed, 32 insertions(+), 45 deletions(-) diff --git a/.github/actions/build-test-and-deploy/build_multiplatform_docker/action.yml b/.github/actions/build-test-and-deploy/build_multiplatform_docker/action.yml index 8ac18fe..d30b279 100644 --- a/.github/actions/build-test-and-deploy/build_multiplatform_docker/action.yml +++ b/.github/actions/build-test-and-deploy/build_multiplatform_docker/action.yml @@ -25,54 +25,41 @@ inputs: description: App version required: true type: string - docker_registry_username: - description: Docker registry username - required: true - type: string - docker_registry_token: - description: Docker registry username - required: true - type: string - git_head_ref: - description: git head ref - required: true - type: string - git_ref_name: - description: git branch name - required: true - type: string runs: using: "composite" steps: - - name: Set version - run: | - echo "version=$app_version" | tee -a "$GITHUB_OUTPUT" + - uses: actions/checkout@v4 + - uses: docker/setup-qemu-action@v2 + - uses: docker/setup-buildx-action@v2 + - name: Docker login if Docker registry is quay.io + if: ${{ inputs.docker_registry == 'quay.io' }} + uses: docker/login-action@v2 + with: + registry: ${{ inputs.docker_registry }} + username: ${{ secrets.HMPPS_QUAYIO_USER }} + password: ${{ secrets.HMPPS_QUAYIO_TOKEN }} - # - uses: actions/checkout@v4 - # - uses: docker/setup-qemu-action@v2 - # - uses: docker/setup-buildx-action@v2 - - # - name: Docker login if Docker registry is quay.io - # uses: docker/login-action@v2 - # with: - # registry: ${{ inputs.docker_registry }} - # username: ${{ inputs.docker_registry_username }} - # password: ${{ inputs.docker_registry_token }} + - name: Docker login if Docker registry is ghcr.io + if: ${{ inputs.docker_registry == 'ghcr.io' }} + uses: docker/login-action@v2 + with: + registry: ${{ inputs.docker_registry }} + username: ${{ github.actor }} + password: ${{ github.token }} - # - name: Build Docker images - # uses: docker/build-push-action@v4 - # with: - # cache-from: type=gha - # cache-to: type=gha,mode=max - # platform: linux/amd64,linux/arm64 - # context: . - # push: ${{ inputs.push }} - # provenance: false - # build-args: | - # "BUILD_NUMBER=${{ inputs.app_version }}" - # "GIT_REF=${{ inputs.git_head_ref }}" - # "GIT_BRANCH=${{ inputs.git_ref_name }}" - # tags: | - # ${{ inputs.docker_registry}}/${{ inputs.registry_org }}/${{ inputs.repository_name }}:latest - # ${{ inputs.docker_registry}}/${{ inputs.registry_org }}/${{ inputs.repository_name }}:${{ inputs.app_version }} + - name: Build Docker images + uses: docker/build-push-action@v4 + with: + cache-from: type=gha + cache-to: type=gha,mode=max + context: . + push: ${{ inputs.push }} + provenance: false + build-args: | + "BUILD_NUMBER=${{ steps.version.outputs.version }}" + "GIT_REF=$${{ github.head_ref }}" + "GIT_BRANCH=$${{ github.ref_name }}" + tags: | + ${{ inputs.docker_registry}}/${{ inputs.registry_org }}/${{ github.event.repository.name }}:latest + ${{ inputs.docker_registry}}/${{ inputs.registry_org }}/${{ github.event.repository.name }}:${{ steps.version.outputs.version }}