add docker release workflow for publishing docker image to ghcr - #8
Conversation
📝 WalkthroughWalkthroughA new GitHub Actions workflow is introduced that automatically publishes Docker images to GHCR when a release is created. The workflow builds and pushes multi-architecture images (AMD64 and ARM64) using Docker Buildx with dynamically generated tags and labels. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In @.github/workflows/docker-release.yml:
- Line 37: The org.opencontainers.image.source label currently uses ${{
github.repository }} which yields "owner/repo" not a full URL; change it to
construct the full GitHub repository URL by using ${{ github.server_url }}/${{
github.repository }} (or ${{ github.repositoryUrl }} if available) so the label
org.opencontainers.image.source contains the complete https://... URL; update
the workflow line referencing org.opencontainers.image.source to use that full
URL expression.
🧹 Nitpick comments (2)
.github/workflows/docker-release.yml (2)
3-5: Consider usingpublishedinstead ofcreatedfor the release trigger.The
createdtype fires when a release is first created, including draft releases. Usingpublishedis more common for release workflows as it triggers when the release is actually published (made public), avoiding accidental image pushes from drafts.Suggested change
on: release: types: - - created + - published
36-36: Consider usingsemvertag type for release-triggered workflows.The
type=ref,name=shortstrategy generates tags based on git refs. For release workflows, usingtype=semverpatterns will extract proper semantic version tags from your release tag (e.g.,v1.2.3→1.2.3,1.2,1,latest).Suggested change for semantic versioning tags
- name: Extract Docker metadata id: meta uses: docker/metadata-action@v5 with: images: ghcr.io/${{ github.repository_owner }}/project-webserver-juv25d - tags: type=ref,name=short + tags: | + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} labels: org.opencontainers.image.source=${{ github.repository }}
Closes #6
Summary by CodeRabbit