Skip to content

feat: v0.3.0 — publish workflow-migrate Docker image to GHCR on release#4

Merged
intel352 merged 3 commits into
mainfrom
feat/v0.3.0-docker-publish
Apr 24, 2026
Merged

feat: v0.3.0 — publish workflow-migrate Docker image to GHCR on release#4
intel352 merged 3 commits into
mainfrom
feat/v0.3.0-docker-publish

Conversation

@intel352
Copy link
Copy Markdown
Contributor

Summary

  • Adds a docker job to .github/workflows/release.yml that builds and pushes ghcr.io/gocodealone/workflow-migrate on every tag
  • Multi-arch: linux/amd64 + linux/arm64 — single build-push-action step via computed tag list
  • Versioned tag (e.g. :v0.3.0) always pushed; :latest pushed only for stable releases (no hyphen in tag)
  • Uses existing cmd/workflow-migrate/Dockerfile unchanged — distroless/static, nonroot user, no shell
  • Runs after goreleaser release job (needs: release)
  • GITHUB_TOKEN only; packages: write scoped to docker job

Why

BMW and other consumers currently clone this repo and build the image from source to run pre-deploy migration jobs. This publishes an official image so they can reference ghcr.io/gocodealone/workflow-migrate:v0.3.0 directly without cloning or building.

Test plan

  • Merge and tag v0.3.0 — verify release workflow runs both release (goreleaser) and docker jobs
  • Confirm ghcr.io/gocodealone/workflow-migrate:v0.3.0 and :latest appear in GHCR packages
  • Pull and run: docker run --rm ghcr.io/gocodealone/workflow-migrate:v0.3.0 --help
  • Verify multi-arch manifest: docker manifest inspect ghcr.io/gocodealone/workflow-migrate:v0.3.0
  • Flag if org package visibility needs admin toggle to public

🤖 Generated with Claude Code

Adds a `docker` job to the release workflow that builds and pushes
ghcr.io/gocodealone/workflow-migrate on every tag:

- Multi-arch: linux/amd64 + linux/arm64 (single build-push-action step)
- Versioned tag (e.g. :v0.3.0) always pushed
- :latest pushed only for stable releases (no hyphen in tag)
- Uses existing cmd/workflow-migrate/Dockerfile unchanged (distroless/static,
  nonroot user, no shell)
- OCI labels: source, version, revision
- Runs after goreleaser release job (needs: release)
- GITHUB_TOKEN only, packages: write permission scoped to docker job

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds automated publishing of the workflow-migrate Docker image to GitHub Container Registry (GHCR) as part of the tag-based release workflow, and documents the release in a new changelog.

Changes:

  • Add a docker job to the release workflow to build/push a multi-arch (amd64/arm64) image to GHCR on tag pushes.
  • Compute and push versioned tags for every release, and conditionally push :latest for stable tags.
  • Add CHANGELOG.md entry for v0.3.0 describing the new official image publishing.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
CHANGELOG.md Introduces a changelog and documents v0.3.0, including GHCR image publishing behavior.
.github/workflows/release.yml Adds a Docker build/push job that runs after the existing release job and publishes multi-arch images to GHCR.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +36 to +38
permissions:
contents: read
packages: write
Copy link

Copilot AI Apr 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR description says packages: write is scoped to the docker job, but the workflow-level permissions block still grants packages: write to all jobs (including release). If least-privilege is the goal, move packages: write off the workflow-level permissions and set it only on the docker job (and keep release to the minimum it needs).

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in fa3eff0: removed packages: write from the workflow-level permissions block. It's now only on the docker job that actually pushes to GHCR.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also addressed binary-drift concern in 10d54fe: pinned Dockerfile Go version to golang:1.26.0-alpine to match go 1.26.0 in go.mod exactly.

Comment thread .github/workflows/release.yml Outdated
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: |
org.opencontainers.image.source=https://github.com/GoCodeAlone/workflow-plugin-migrations
Copy link

Copilot AI Apr 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

org.opencontainers.image.source is hard-coded to a specific GitHub URL; this can become inaccurate if the repo is renamed or the workflow is reused in a fork. Consider deriving it from ${{ github.server_url }} and ${{ github.repository }} so the label always matches the source repository.

Suggested change
org.opencontainers.image.source=https://github.com/GoCodeAlone/workflow-plugin-migrations
org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in fa3eff0: replaced the hardcoded URL with ${{ github.server_url }}/${{ github.repository }} for fork-safety.

…ce label

- Remove packages: write from workflow-level permissions (already explicitly
  scoped to the docker job that pushes to GHCR)
- Replace hardcoded org.opencontainers.image.source URL with
  ${{ github.server_url }}/${{ github.repository }} for fork-safety

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Prevents binary drift between the goreleaser-built release binary
(pinned to go 1.26.0 via go-version-file: go.mod) and the Dockerfile-
built image binary. If go.mod's Go version is bumped, this line must
be bumped to match.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@intel352 intel352 merged commit 7d5cd5e into main Apr 24, 2026
4 checks passed
@intel352 intel352 deleted the feat/v0.3.0-docker-publish branch April 24, 2026 16:05
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