From f93b666bbfd1b484757cee7631e9c8d9dcc5d0ed Mon Sep 17 00:00:00 2001 From: Krishan <33421343+kfiven@users.noreply.github.com> Date: Sat, 20 Aug 2022 20:59:02 +0530 Subject: [PATCH] Push Docker image to ghcr registry (#764) * Push Docker image to ghcr registry * Fix secret name * add permission to token to write package to ghcr Co-authored-by: Ajay Bura <32841439+ajbura@users.noreply.github.com> --- .github/workflows/prod-deploy.yml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/prod-deploy.yml b/.github/workflows/prod-deploy.yml index 7147c75..37b5179 100644 --- a/.github/workflows/prod-deploy.yml +++ b/.github/workflows/prod-deploy.yml @@ -64,10 +64,11 @@ jobs: NETLIFY_DEPLOY_TO_PROD: true push-to-dockerhub: - name: Push Docker image to Docker Hub + name: Push Docker image to Docker Hub, ghcr runs-on: ubuntu-latest permissions: contents: read + packages: write steps: - name: Checkout repository uses: actions/checkout@v3.0.2 @@ -80,11 +81,19 @@ jobs: with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} + - name: Login to the Container registry + uses: docker/login-action@v2.0.0 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - name: Extract metadata (tags, labels) for Docker id: meta uses: docker/metadata-action@v4.0.1 with: - images: ajbura/cinny + images: | + ${{ secrets.DOCKER_USERNAME }}/cinny + ghcr.io/${{ github.repository }} - name: Build and push Docker image uses: docker/build-push-action@v3.1.1 with: