From e3029029749292212e0eacf23e81bc2328ffe1ae Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Wed, 24 Dec 2025 17:37:55 +0000 Subject: [PATCH] fix: Update GitHub Actions workflow to publish to GHCR - Updated `.github/workflows/docker-publish.yml` to enable pushing to GHCR. - Added permissions block for `packages: write`. - Added `docker/login-action` to authenticate with GITHUB_TOKEN. - Added `docker/metadata-action` for proper tagging. - Enabled `push: true` in build-push-action. - Configured multi-arch builds (linux/amd64, linux/arm64). --- .github/workflows/docker-publish.yml | 35 ++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 06a4624..51ef217 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -6,9 +6,17 @@ on: pull_request: branches: [ "main" ] +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + jobs: build: runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: - uses: actions/checkout@v3 @@ -18,9 +26,32 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 + - name: Log in to the Container registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=ref,event=branch + type=ref,event=pr + type=semver,pattern={{version}} + type=sha + latest + - name: Build and push uses: docker/build-push-action@v5 with: context: ./backend - push: false - tags: user/app:latest + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + platforms: linux/amd64,linux/arm64 + cache-from: type=gha + cache-to: type=gha,mode=max