Skip to content

Add automated GHCR publish + versioned Git tag/release workflow#1

Merged
itsrofly merged 3 commits into
mainfrom
copilot/add-github-actions-workflow
May 21, 2026
Merged

Add automated GHCR publish + versioned Git tag/release workflow#1
itsrofly merged 3 commits into
mainfrom
copilot/add-github-actions-workflow

Conversation

Copy link
Copy Markdown

Copilot AI commented May 21, 2026

This PR adds release automation so every push to the default branch builds/publishes the Docker image and creates a matching Git tag + GitHub Release for traceability. The Docker latest tag and version tag are emitted together from the same workflow run.

  • Workflow scope

    • Adds .github/workflows/docker-release.yml
    • Triggers on pushes to main
    • Uses the repository Dockerfile as build source
  • Image publishing

    • Publishes to ghcr.io/hichbox/mmdb-server
    • Pushes both:
      • :latest
      • :<version> where version is deterministic from commit state
  • Versioning + release alignment

    • Computes version as vYYYY-MM-DD.<short_sha>
    • Reuses that exact value for:
      • Docker image version tag
      • Git tag
      • GitHub Release name/tag
  • Idempotent tag/release creation

    • If tag exists on the same commit, creation is skipped
    • If release for that tag exists, creation is skipped
    • If tag exists but points to a different commit, the job fails to prevent unsafe reuse
  • Permissions/auth

    • Uses GITHUB_TOKEN for GHCR auth and GitHub API operations
    • Minimal job permissions: contents: write, packages: write
tags: |
  ghcr.io/${{ github.repository_owner }}/mmdb-server:latest
  ghcr.io/${{ github.repository_owner }}/mmdb-server:${{ steps.version.outputs.version_tag }}
Original prompt

Add a GitHub Actions workflow to repo hichbox/mmdb-server that builds and publishes a Docker image from the existing Dockerfile on every commit, tagging it as mmdb-server:latest, and also creating a Git tag + GitHub Release for the same version tag used for the Docker image.

Requirements:

  • Use the repository Dockerfile to build the image.
  • On every push (commit) to the default branch, build and publish the Docker image.
  • Image tagging:
    • Always publish a latest tag (equivalent to mmdb-server:latest).
    • Also publish a versioned tag that matches the Git tag/release version for traceability.
  • Release/tagging:
    • Create a Git tag and a GitHub Release each time, using the same version string as the Docker image version tag.
    • Version format: derive from repository state (e.g., semantic version) in a deterministic way; if no existing versioning scheme is present, implement a simple auto-version approach such as vYYYY.MM.DD.<run_number> or v<date>-<short_sha>.
  • Publish destination:
    • Publish the Docker image as a package on GitHub Container Registry (GHCR) under ghcr.io/hichbox/mmdb-server.
  • Permissions:
    • Workflow must use minimal required permissions.
    • Use GITHUB_TOKEN for authentication to GHCR and for creating tags/releases.
  • Ensure the workflow does not attempt to create duplicate tags/releases on the same commit; handle idempotency safely.

Deliverables:

  • Add workflow file under .github/workflows/ (e.g., docker-release.yml).
  • If necessary, add supporting scripts/configuration to compute version tag.
  • Document briefly in README how tagging works (optional, only if needed to clarify).

The following is the prior conversation context from the user's chat exploration (may be truncated):

User: create a workflow that creates a docker package, use the Dockerfile, always a commit it's made creates a mmdb-server:latest and also a release and tag for tracking the same tag version should be the same tag mmbd-server docker image version

Assistant: I’m waiting for you to approve the pending automated change so I can proceed with adding the GitHub Actions workflow that builds/publishes the Docker image and creates the matching tag + release.

This pull request was created from Copilot chat.

Copilot AI and others added 2 commits May 21, 2026 15:51
Copilot AI changed the title [WIP] Add GitHub Actions workflow for Docker image builds Add automated GHCR publish + versioned Git tag/release workflow May 21, 2026
Copilot AI requested a review from itsrofly May 21, 2026 15:55
@itsrofly itsrofly closed this May 21, 2026
@itsrofly itsrofly reopened this May 21, 2026
@itsrofly itsrofly marked this pull request as ready for review May 21, 2026 15:58
@itsrofly itsrofly merged commit 4d76e2c into main May 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants