Skip to content

push-to-registry

push-to-registry #120

name: push-to-registry
on:
workflow_run:
workflows: [build-and-test]
branches: [main]
types:
- completed
jobs:
push-image-to-registry:
name: Push Docker image to Github registry
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Log in to the Github Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build a Docker image
run: |
docker build -t ghcr.io/lvchkn/hnfeed:latest .
- name: Push the image to ghcr
run: |
docker push ghcr.io/lvchkn/hnfeed:latest