docker-publish

Docker Publish Action

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 latest for prereleases.

✨ Features

[!IMPORTANT]

CI/CD Runner Requirement

Recommended Runner: ubuntu-latest

This action must be executed on a Linux GitHub Actions runner.

runs-on: ubuntu-latest

Why Linux runners?

What this means

This is the standard and recommended setup for Docker-based CI/CD workflows.

πŸš€ Quick Start

- uses: teneplaysofficial/docker-publish@v1
  with:
    image_repo: tenedev/release-hub
    version: v1.2.4
    docker_username: $
    docker_password: $

🏷 Tagging Strategy (Important)

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.

🟒 Stable Release (no -)

Example

1.2.3
v1.2.4

Tags pushed

:1.2.4
:latest
:1

πŸ”΄ Numeric Prerelease β†’ next

Example

1.2.3-1
1.2.3-34

Tags pushed

:1.2.3-34
:next

🟑 Labeled Prerelease β†’ label tag

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

πŸ” Tag Safety Rules

These rules are enforced automatically and cannot be disabled.

🧬 Multi-Platform Support

By default, images are built for:

linux/amd64
linux/arm64

Image runtime support

These images run on:

πŸ§ͺ Dry-Run Mode

When dry_run: true:

Ideal for CI validation and release previews.

⚑ Docker Layer Caching

This action uses GitHub Actions cache for Docker layers.

Benefits

No configuration required.

βš™οΈ Inputs

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

πŸ›‘ Fail-Fast Behavior

The workflow intentionally fails if:

This prevents broken or unsafe releases.

πŸ§ͺ Full Example Workflow

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: $
          docker_username: $
          docker_password: $

The action automatically strips the leading v from Git tags.

🧾 Job Summary Output

When summary: true, the action publishes a job summary including:

This improves traceability and auditability.

Sample Job Summary

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/arm64

Prerelease (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/arm64

πŸ›‘ Why This Action?

Most Docker workflows:

This action:

πŸ” Security & Transparency

πŸ™Œ Contributing

Issues and PRs are welcome. This action is intentionally small, focused, and predictable.