Docker Release Action
Automated Docker image building and publishing with semantic versioning, multi-platform support, and consistent tagging.
The Problem
Setting up Docker CI/CD from scratch means writing the same 50+ lines of workflow YAML every time. Login to any OCI complaint registry, configure buildx, set up multi-platform builds, manage tags, handle versioning. And when you need to fix a bug or add a feature to that process, you have to update every single repository.
I was doing this across dozens of projects. The workflow files were nearly identical, just with different image names and minor variations. It was maintenance hell.
The Solution
This action encapsulates the entire Docker build and release process into a single reusable step. You provide credentials and an image name, and it handles everything else - versioning, tagging, multi-platform builds, and publishing.
The real value isn't in the automation itself. It's in centralized maintenance. When I improve the action or fix a bug, every project using it benefits immediately. No hunting through repositories to update workflow files.
Key Capabilities
- Flexible versioning: Integrates with GitVersion, accepts manual versions, or uses defaults for dev builds
- Automatic tagging: Creates version,
latest, and SHA-based tags for every build - Multi-platform support: Build for multiple architectures in a single workflow run
- Minimal configuration: Sensible defaults with overrides only when needed
- Supports any OCI compliant registry: Specify a custom registry if you want to upload to your private registry. Defaults to docker hub.
Quick Example
Docker hub
Docker hub is the default registry when using the action so you do not need to specify it
- name: Build and release
uses: michielvha/docker-release-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
project: example-app
version: ${{ env.GITVERSION_SEMVER }}GitHub Container Registry
By using the GitHub native container registry, we get seamless integration out of the box. GitHub automatically exposes variables like the actor and token, so we can authenticate and push images without extra configuration or secrets management.
WARNING
if you don't add the permissions section the github token will have insufficient write permissions
permissions:
id-token: write
contents: write
packages: write
- name: Build and Push Docker Image
uses: michielvha/docker-release-action@main
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
project: 'example-app'
version: ${{ steps.gitversion.outputs.semVer }}
platforms: 'linux/amd64,linux/arm64'
context: '.'That's it. The action handles login, build, tag, and push.
Why This Matters
Reusable CI/CD components reduce cognitive load for developers. They don't need to understand Docker buildx arguments or tagging strategies. They add a few lines to their workflow and get a complete release pipeline.
Platform engineering is about removing friction. This action removes the friction of setting up and maintaining Docker CI/CD across multiple projects.
For detailed usage, configuration options, and examples, see the GitHub repository.
