In the blog I will present you a ready-to-use Github action workflow to push container images to the image registry. In modern software development, we depend on container images a lot. As Github now has its own container image registry – ghcr.io too, it becomes easy to build and push images directly to a registry within a single workflow.
Github Action Workflow
Below you see the ready-to-use Github action workflow to push your container image to the Github container registry ghcr.io:
As you can see, it will work on any repository. If you have a git repository for a container image, just add this workflow.
- it pushes into the container registry corresponding with the repository
- it uses
git describe --tags HEAD
to generate a semver tag for the image - it builds a multi-architecture image for amd64 and arm64
- it runs on every push to the main branch, or tag of a commit
Pretty neat, huh?
install the workflow
To install the workflow, type the following commands:
To make a beautiful semantic version release of your image, type:
Checkout the resulting Github action workflow!
Conclusion
With the availability of the Github container image registry, this simple ready-to-use workflow make Github a one-stop-shop to build and distribute your container images!
Photo by Jakob Owens on Unsplash