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>
This commit is contained in:
Krishan 2022-08-20 20:59:02 +05:30 committed by GitHub
parent 7e28aa1474
commit f93b666bbf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -64,10 +64,11 @@ jobs:
NETLIFY_DEPLOY_TO_PROD: true NETLIFY_DEPLOY_TO_PROD: true
push-to-dockerhub: push-to-dockerhub:
name: Push Docker image to Docker Hub name: Push Docker image to Docker Hub, ghcr
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions: permissions:
contents: read contents: read
packages: write
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v3.0.2 uses: actions/checkout@v3.0.2
@ -80,11 +81,19 @@ jobs:
with: with:
username: ${{ secrets.DOCKER_USERNAME }} username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }} 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 - name: Extract metadata (tags, labels) for Docker
id: meta id: meta
uses: docker/metadata-action@v4.0.1 uses: docker/metadata-action@v4.0.1
with: with:
images: ajbura/cinny images: |
${{ secrets.DOCKER_USERNAME }}/cinny
ghcr.io/${{ github.repository }}
- name: Build and push Docker image - name: Build and push Docker image
uses: docker/build-push-action@v3.1.1 uses: docker/build-push-action@v3.1.1
with: with: