From 4a83a0a4e22a9c1dfad8b9efd1106fbe3e4c7ba8 Mon Sep 17 00:00:00 2001 From: Praveenraj-K Date: Thu, 3 Oct 2024 19:14:03 +0530 Subject: [PATCH] GHCR- Push Update backup repo images to push their docker image to GHCR Packages registry --- .github/workflows/build-and-publish.yml | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-and-publish.yml b/.github/workflows/build-and-publish.yml index 65d09e0..f359e71 100644 --- a/.github/workflows/build-and-publish.yml +++ b/.github/workflows/build-and-publish.yml @@ -17,16 +17,29 @@ jobs: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Extract metadata (tags, labels) for Docker id: meta uses: docker/metadata-action@v5 with: images: ${{ vars.DOCKER_ORG }}/${{ github.event.repository.name }} - - name: Build and push Docker image + - name: Build and push Docker image to Docker Hub uses: docker/build-push-action@v5 with: context: . push: true tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} + + - name: Build and push Docker image to GitHub Container Registry + uses: docker/build-push-action@v5 + with: + context: . + push: true + tags: ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:${{ steps.meta.outputs.tags }}