From 1d3f4d6c055d7166a24e6b7fe6b4e3c65d1191be Mon Sep 17 00:00:00 2001 From: Adil Hafeez Date: Thu, 2 Apr 2026 18:08:49 -0700 Subject: [PATCH] Publish docker images to DigitalOcean Container Registry (#868) --- .github/workflows/docker-push-release.yml | 81 +++++++++++++++++++++++ 1 file changed, 81 insertions(+) diff --git a/.github/workflows/docker-push-release.yml b/.github/workflows/docker-push-release.yml index 0c275cbc..bb468ba7 100644 --- a/.github/workflows/docker-push-release.yml +++ b/.github/workflows/docker-push-release.yml @@ -3,10 +3,13 @@ name: Publish docker image (release) env: DOCKER_IMAGE: katanemo/plano GHCR_IMAGE: ghcr.io/${{ github.repository_owner }}/plano + DOCR_IMAGE: registry.digitalocean.com/genai-prod/plano + DOCR_PREVIEW_IMAGE: registry.digitalocean.com/genai-preview/plano on: release: types: [published] + workflow_dispatch: # remove after testing permissions: contents: read @@ -33,6 +36,14 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} + - name: Install doctl + uses: digitalocean/action-doctl@v2 + with: + token: ${{ secrets.PLATFORM_DIGITALOCEAN_TOKEN }} + + - name: Log in to DOCR (prod) + run: doctl registry login + - name: Extract metadata for Docker id: meta uses: docker/metadata-action@v5 @@ -51,6 +62,21 @@ jobs: tags: | ${{ steps.meta.outputs.tags }}-arm64 ${{ env.GHCR_IMAGE }}:${{ github.event.release.tag_name }}-arm64 + ${{ env.DOCR_IMAGE }}:${{ github.event.release.tag_name }}-arm64 + + - name: Switch to DOCR preview + uses: digitalocean/action-doctl@v2 + with: + token: ${{ secrets.PLATFORM_DIGITALOCEAN_TOKEN_PREVIEW }} + + - name: Log in to DOCR (preview) + run: doctl registry login + + - name: Push to DOCR Preview + run: | + docker buildx imagetools create \ + -t ${{ env.DOCR_PREVIEW_IMAGE }}:${{ github.event.release.tag_name }}-arm64 \ + ${{ steps.meta.outputs.tags }}-arm64 # Build AMD64 image on GitHub's AMD64 runner — push to both registries build-amd64: @@ -72,6 +98,14 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} + - name: Install doctl + uses: digitalocean/action-doctl@v2 + with: + token: ${{ secrets.PLATFORM_DIGITALOCEAN_TOKEN }} + + - name: Log in to DOCR (prod) + run: doctl registry login + - name: Extract metadata for Docker id: meta uses: docker/metadata-action@v5 @@ -90,6 +124,21 @@ jobs: tags: | ${{ steps.meta.outputs.tags }}-amd64 ${{ env.GHCR_IMAGE }}:${{ github.event.release.tag_name }}-amd64 + ${{ env.DOCR_IMAGE }}:${{ github.event.release.tag_name }}-amd64 + + - name: Switch to DOCR preview + uses: digitalocean/action-doctl@v2 + with: + token: ${{ secrets.PLATFORM_DIGITALOCEAN_TOKEN_PREVIEW }} + + - name: Log in to DOCR (preview) + run: doctl registry login + + - name: Push to DOCR Preview + run: | + docker buildx imagetools create \ + -t ${{ env.DOCR_PREVIEW_IMAGE }}:${{ github.event.release.tag_name }}-amd64 \ + ${{ steps.meta.outputs.tags }}-amd64 # Combine ARM64 and AMD64 images into multi-arch manifests for both registries create-manifest: @@ -109,6 +158,14 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} + - name: Install doctl + uses: digitalocean/action-doctl@v2 + with: + token: ${{ secrets.PLATFORM_DIGITALOCEAN_TOKEN }} + + - name: Log in to DOCR (prod) + run: doctl registry login + - name: Extract metadata for Docker id: meta uses: docker/metadata-action@v5 @@ -131,3 +188,27 @@ jobs: -t ${{ env.GHCR_IMAGE }}:${TAG} \ ${{ env.GHCR_IMAGE }}:${TAG}-arm64 \ ${{ env.GHCR_IMAGE }}:${TAG}-amd64 + + - name: Create DOCR Prod Multi-Arch Manifest + run: | + TAG=${{ github.event.release.tag_name }} + docker buildx imagetools create \ + -t ${{ env.DOCR_IMAGE }}:${TAG} \ + ${{ env.DOCR_IMAGE }}:${TAG}-arm64 \ + ${{ env.DOCR_IMAGE }}:${TAG}-amd64 + + - name: Switch to DOCR preview + uses: digitalocean/action-doctl@v2 + with: + token: ${{ secrets.PLATFORM_DIGITALOCEAN_TOKEN_PREVIEW }} + + - name: Log in to DOCR (preview) + run: doctl registry login + + - name: Create DOCR Preview Multi-Arch Manifest + run: | + TAG=${{ github.event.release.tag_name }} + docker buildx imagetools create \ + -t ${{ env.DOCR_PREVIEW_IMAGE }}:${TAG} \ + ${{ steps.meta.outputs.tags }}-arm64 \ + ${{ steps.meta.outputs.tags }}-amd64