I am also facing this issue but I am not doing it from organisation(its from my personal profile) So, let me explain you what I did to solve this
name: "Build Docker Registry"
runs-on: ubuntu-22.04
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: ghcr.io
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
file: ${{ env.DOCKERFILE_PATH }}
push: true
tags: |
ghcr.io/${{ github.repository_owner }}/${{ env.DOCKER_IMAGE_NAME }}:${{ github.sha }}
Do it this also,
you can see the full .yaml file here - https://github.com/manzil-infinity180/dumpStore_backend/blob/main/.github/workflows/ci.yaml