- build-and-push: This workflow builds a docker image from a dockerfile located in the root of your project. It automatically pushes it to the github container registry.
Make sure to enablek Read and write permissions for github actions workflows.
This can be done in (Repository) Settings > Actions > General > Workflow permissions:

Paste this in your .github/workflows/build-and-push.yml file and change the image name.
name: Build and Push Docker image
on:
push:
branches:
- "**"
tags:
- "v*"
jobs:
build-and-push:
uses: LeBogoo/workflows/.github/workflows/[email protected]
with:
image_name: "my_project"
secrets:
GHCR_TOKEN: ${{ secrets.GITHUB_TOKEN }}