Skip to content

Commit 1210d0d

Browse files
committed
fix: consolidate release and Docker publishing workflows
- Integrate Docker publishing directly into release workflow - Remove separate docker-publish.yml workflow to eliminate conflicts - Ensure exact version matching between GitHub releases and GHCR packages - Publish both versioned tag (e.g., v1.1.4) and latest tag simultaneously - This resolves the issue where packages weren't published after releases
1 parent 0b7f64e commit 1210d0d

File tree

2 files changed

+55
-114
lines changed

2 files changed

+55
-114
lines changed

.github/workflows/docker-publish.yml

Lines changed: 0 additions & 113 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,4 +177,58 @@ jobs:
177177
body_path: changelog.md
178178
draft: false
179179
prerelease: false
180-
generate_release_notes: true
180+
generate_release_notes: true
181+
182+
publish-docker:
183+
needs: [check-changes, create-release]
184+
if: needs.check-changes.outputs.should_release == 'true' || github.event_name == 'workflow_dispatch'
185+
runs-on: ubuntu-latest
186+
permissions:
187+
contents: read
188+
packages: write
189+
190+
steps:
191+
- name: Checkout repository
192+
uses: actions/checkout@v4
193+
194+
- name: Set up Docker Buildx
195+
uses: docker/setup-buildx-action@v3
196+
197+
- name: Log in to Container Registry
198+
uses: docker/login-action@v3
199+
with:
200+
registry: ghcr.io
201+
username: ${{ github.actor }}
202+
password: ${{ secrets.GITHUB_TOKEN }}
203+
204+
- name: Build and push Docker image
205+
uses: docker/build-push-action@v5
206+
with:
207+
context: .
208+
file: ./Dockerfile
209+
platforms: linux/amd64,linux/arm64
210+
push: true
211+
tags: |
212+
ghcr.io/${{ github.repository }}:${{ needs.check-changes.outputs.version }}
213+
ghcr.io/${{ github.repository }}:latest
214+
cache-from: type=gha
215+
cache-to: type=gha,mode=max
216+
217+
- name: Generate Docker summary
218+
run: |
219+
echo "## 🐳 Docker Image Published" >> $GITHUB_STEP_SUMMARY
220+
echo "" >> $GITHUB_STEP_SUMMARY
221+
echo "**Version:** ${{ needs.check-changes.outputs.version }}" >> $GITHUB_STEP_SUMMARY
222+
echo "" >> $GITHUB_STEP_SUMMARY
223+
echo "**Registry:** ghcr.io" >> $GITHUB_STEP_SUMMARY
224+
echo "" >> $GITHUB_STEP_SUMMARY
225+
echo "**Tags:**" >> $GITHUB_STEP_SUMMARY
226+
echo '```' >> $GITHUB_STEP_SUMMARY
227+
echo "ghcr.io/${{ github.repository }}:${{ needs.check-changes.outputs.version }}" >> $GITHUB_STEP_SUMMARY
228+
echo "ghcr.io/${{ github.repository }}:latest" >> $GITHUB_STEP_SUMMARY
229+
echo '```' >> $GITHUB_STEP_SUMMARY
230+
echo "" >> $GITHUB_STEP_SUMMARY
231+
echo "**Pull command:**" >> $GITHUB_STEP_SUMMARY
232+
echo '```bash' >> $GITHUB_STEP_SUMMARY
233+
echo "docker pull ghcr.io/${{ github.repository }}:${{ needs.check-changes.outputs.version }}" >> $GITHUB_STEP_SUMMARY
234+
echo '```' >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)