Build and publish Docker images to Docker Hub with a safe, opinionated tagging strategy, multi-platform support, and zero boilerplate.
This action is designed to prevent common release mistakes such as accidentally pushing
latestfor prereleases.
-
π§± Build once, push multiple tags
-
π· Smart SemVer-based tagging
-
𧬠Multi-platform images
linux/amd64linux/arm64
-
π Supports versions without
vprefix (v1.2.3β1.2.3) -
β‘ Uses Docker Buildx + QEMU
-
π§© Composite action (transparent & easy to audit)
-
π¦ Docker Hub compatible
-
π§ Fail-fast safety checks
-
β‘ GitHub Actions cache for Docker layers
-
π§ͺ Dry-run support
-
π§Ύ Automatic job summary
-
π« Strict tag safety guarantees
Important
Recommended Runner: ubuntu-latest
This action must be executed on a Linux GitHub Actions runner.
runs-on: ubuntu-latestWhy Linux runners?
- Docker image builds require Linux kernel features.
- GitHub-hosted macOS and Windows runners do not provide Docker Desktop.
- Docker Desktop (used locally on macOS/Windows) cannot run inside CI runners.
- Linux runners provide a native Docker daemon required by Buildx.
What this means
- Builds run on Linux CI runners.
- Built images run on Linux, macOS, and Windows via Docker Desktop or WSL2.
- macOS / Windows runners are not supported for building.
This is the standard and recommended setup for Docker-based CI/CD workflows.
- uses: teneplaysofficial/docker-publish@v1
with:
image_repo: tenedev/release-hub
version: v1.2.4
docker_username: ${{ secrets.DOCKERHUB_USERNAME }}
docker_password: ${{ secrets.DOCKERHUB_TOKEN }}The action determines tags only from the version string. All tags are derived strictly and exclusively from the provided version. No tags are inferred from Git history, branches, or commit metadata.
Example
1.2.3
v1.2.4
Tags pushed
:1.2.4
:latest
:1
Example
1.2.3-1
1.2.3-34
Tags pushed
:1.2.3-34
:next
Example
1.2.3-beta.2
1.2.3-alpha
1.2.3-rc.1
Tags pushed
:1.2.3-beta.2
:beta
:1.2.3-alpha
:alpha
:1.2.3-rc.1
:rc
latestis pushed only for stable releases- Major tags (e.g.
:1) are only for stable releases - Prereleases can never overwrite stable tags
- Invalid tag strategies fail the workflow before push
These rules are enforced automatically and cannot be disabled.
By default, images are built for:
linux/amd64
linux/arm64
These images run on:
- Linux servers (native)
- macOS (Docker Desktop)
- Windows (Docker Desktop / WSL2)
When dry_run: true:
- Image is built.
- Tags are generated and validated.
- Multi-platform build runs.
- Images are not pushed.
- Registry state is untouched.
Ideal for CI validation and release previews.
This action uses GitHub Actions cache for Docker layers.
Benefits
- Faster rebuilds
- No external cache registry
- Works automatically across workflow runs
No configuration required.
| Name | Required | Default | Description |
|---|---|---|---|
image_repo |
β | β | Docker image repo (username/repo) |
version |
β | β | App version (1.2.3, v1.2.3-beta.2) |
docker_username |
β | β | Docker Hub username |
docker_password |
β | β | Docker Hub token/password |
context_path |
β | . |
Docker build context |
dockerfile_path |
β | ./Dockerfile |
Path to Dockerfile |
dry_run |
β | false |
Build only, do not push images |
summary |
β | true |
Generate job summary |
The workflow intentionally fails if:
image_repois not innamespace/repoformat.- No Docker tags are generated.
- A prerelease attempts to publish
latest. - Tag generation results in an empty set.
- Docker build fails for any platform.
This prevents broken or unsafe releases.
name: Docker Release
on:
push:
tags:
- "v*"
jobs:
docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: teneplaysofficial/docker-publish@v1
with:
image_repo: tenedev/release-hub
version: ${{ github.ref_name }}
docker_username: ${{ secrets.DOCKERHUB_USERNAME }}
docker_password: ${{ secrets.DOCKERHUB_TOKEN }}The action automatically strips the leading
vfrom Git tags.
When summary: true, the action publishes a job summary including:
- Image name.
- Normalized version.
- Release type.
- Published tags.
- Target platforms.
- Execution mode (publish / dry-run).
This improves traceability and auditability.
Below is an example of what appears in the GitHub Actions β Job Summary panel:
## Docker Publish Summary
Image: `tenedev/release-hub`
Version: `1.2.4`
Strategy: `stable`
Mode: publish
### Tags
- `tenedev/release-hub:1.2.4`
- `tenedev/release-hub:latest`
- `tenedev/release-hub:1`
### Platforms
- linux/amd64
- linux/arm64Prerelease (Dry-Run) Example
## Docker Publish Summary
Image: `tenedev/release-hub`
Version: `1.3.0-rc.1`
Strategy: `labeled`
Mode: dry-run
### Tags
- `tenedev/release-hub:1.3.0-rc.1`
- `tenedev/release-hub:rc`
### Platforms
- linux/amd64
- linux/arm64Most Docker workflows:
- Push
latestaccidentally. - Rebuild per tag.
- Donβt support ARM.
- Copy-paste huge YAML blocks.
This action:
- Encodes safe defaults.
- Keeps workflows short.
- Follows real SemVer rules.
- Scales cleanly across projects.
- Uses official Docker GitHub Actions.
- Secrets used only for authentication.
- No secrets exposed to build steps.
- No bundled binaries.
- No Node.js runtime.
- No compiled artifacts.
- Fully auditable YAML + Bash.
Issues and PRs are welcome. This action is intentionally small, focused, and predictable.