From e18c6852ee4adbdfa208770dab32ade8f668d96e Mon Sep 17 00:00:00 2001 From: Praveen Date: Wed, 9 Oct 2024 16:30:37 +0530 Subject: [PATCH 1/2] Pushing images into ghcr.io --- .github/workflows/test-and-publish.yml | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-and-publish.yml b/.github/workflows/test-and-publish.yml index 1173d0cb..c440371a 100644 --- a/.github/workflows/test-and-publish.yml +++ b/.github/workflows/test-and-publish.yml @@ -2,6 +2,8 @@ name: Test and Publish on: push: + branches: [ 'main' ] #Trigger on Push event to 'main' branch + tags: [ '[0-9]+.[0-9]+.[0-9]+'] # Trigger for the version tags '1.0.1' jobs: tests: @@ -26,20 +28,32 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v4 + # Step to log into the DockerHub - name: Log in to Docker Hub uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Extract metadata (tags, labels) for Docker + # Step to log into the GHCR + - name: Log in to GHCR.io + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor}} + password: ${{ secrets.GITHUB_TOKEN}} + # Step to Extract the meta for the image + - name: Extract metadata (tags, labels) for Docker Images id: meta uses: docker/metadata-action@v5 with: - images: ${{ vars.DOCKER_ORG }}/${{ github.event.repository.name }} + images: | + ${{ vars.DOCKER_ORG }}/${{ github.event.repository.name }} + ghcr.io/${{ github.repository}} tags: | type=ref,event=branch type=semver,pattern={{version}} type=semver,pattern={{major}}.{{minor}} + - name: Build and push Docker image uses: docker/build-push-action@v5 with: From 6de27a7215391f3c86024a35c9c715f090134984 Mon Sep 17 00:00:00 2001 From: Praveen Date: Thu, 10 Oct 2024 11:21:13 +0530 Subject: [PATCH 2/2] Pushing images into ghcr.io --- .github/workflows/test-and-publish.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test-and-publish.yml b/.github/workflows/test-and-publish.yml index c440371a..73c738a3 100644 --- a/.github/workflows/test-and-publish.yml +++ b/.github/workflows/test-and-publish.yml @@ -39,8 +39,8 @@ jobs: uses: docker/login-action@v3 with: registry: ghcr.io - username: ${{ github.actor}} - password: ${{ secrets.GITHUB_TOKEN}} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} # Step to Extract the meta for the image - name: Extract metadata (tags, labels) for Docker Images id: meta @@ -48,12 +48,12 @@ jobs: with: images: | ${{ vars.DOCKER_ORG }}/${{ github.event.repository.name }} - ghcr.io/${{ github.repository}} + ghcr.io/${{ github.repository }} tags: | type=ref,event=branch type=semver,pattern={{version}} type=semver,pattern={{major}}.{{minor}} - + - name: Build and push Docker image uses: docker/build-push-action@v5 with: