|
| 1 | +name: release-docker |
| 2 | + |
| 3 | +# Publishes a Docker image for a specific CLI release tag to ghcr.io/databricks/cli. |
| 4 | +# |
| 5 | +# Why this is a separate workflow (not part of release-build): |
| 6 | +# The release pipeline was simplified in April 2026 (commit 6a0ddd896) by |
| 7 | +# consolidating two goreleaser configs into one. Docker publishing was |
| 8 | +# intentionally removed from goreleaser at that point ("to be handled |
| 9 | +# separately") because goreleaser's docker_manifests step was broken by |
| 10 | +# Docker 29.x changing how buildx pushes single-platform images (they became |
| 11 | +# OCI manifest lists, which goreleaser could not merge). Rather than pin the |
| 12 | +# entire release runner to Docker 28.x indefinitely, Docker publishing was |
| 13 | +# decoupled into this standalone workflow that uses `docker buildx imagetools` |
| 14 | +# directly and is unaffected by the goreleaser/Docker compatibility issue. |
| 15 | + |
| 16 | +on: |
| 17 | + workflow_dispatch: |
| 18 | + inputs: |
| 19 | + tag: |
| 20 | + description: "Release tag to publish (e.g. v0.298.0)" |
| 21 | + type: string |
| 22 | + required: true |
| 23 | + update_latest: |
| 24 | + description: "Also update the 'latest' and 'latest-<arch>' tags" |
| 25 | + type: boolean |
| 26 | + default: true |
| 27 | + |
| 28 | +jobs: |
| 29 | + docker: |
| 30 | + runs-on: |
| 31 | + group: databricks-protected-runner-group-large |
| 32 | + labels: linux-ubuntu-latest-large |
| 33 | + |
| 34 | + permissions: |
| 35 | + packages: write |
| 36 | + contents: read |
| 37 | + |
| 38 | + steps: |
| 39 | + - name: Checkout repository at release tag |
| 40 | + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 41 | + with: |
| 42 | + ref: ${{ inputs.tag }} |
| 43 | + |
| 44 | + - name: Set up QEMU for cross-platform builds |
| 45 | + uses: docker/setup-qemu-action@ce360397dd3f832beb865e1373c09c0e9f86d70a # v4.0.0 |
| 46 | + |
| 47 | + - name: Create a buildx builder with multi-platform support |
| 48 | + run: docker buildx create --use --driver docker-container |
| 49 | + |
| 50 | + - name: Log in to GitHub Container Registry |
| 51 | + uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2 # v4.0.0 |
| 52 | + with: |
| 53 | + registry: ghcr.io |
| 54 | + username: ${{ github.actor }} |
| 55 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 56 | + |
| 57 | + - name: Strip leading 'v' from tag |
| 58 | + id: version |
| 59 | + run: echo "version=${TAG#v}" >> "$GITHUB_OUTPUT" |
| 60 | + env: |
| 61 | + TAG: ${{ inputs.tag }} |
| 62 | + |
| 63 | + - name: Download CLI release binaries |
| 64 | + run: | |
| 65 | + VERSION="${{ steps.version.outputs.version }}" |
| 66 | + TAG="${{ inputs.tag }}" |
| 67 | + for ARCH in amd64 arm64; do |
| 68 | + curl -sfL \ |
| 69 | + "https://github.com/databricks/cli/releases/download/${TAG}/databricks_cli_${VERSION}_linux_${ARCH}.tar.gz" \ |
| 70 | + -o "/tmp/databricks_${ARCH}.tar.gz" |
| 71 | + mkdir -p "/tmp/cli_${ARCH}" |
| 72 | + tar -xzf "/tmp/databricks_${ARCH}.tar.gz" -C "/tmp/cli_${ARCH}" databricks |
| 73 | + done |
| 74 | +
|
| 75 | + - name: Build and push amd64 image |
| 76 | + run: | |
| 77 | + cp /tmp/cli_amd64/databricks ./databricks |
| 78 | + docker buildx build \ |
| 79 | + --platform linux/amd64 \ |
| 80 | + --build-arg ARCH=amd64 \ |
| 81 | + --tag "ghcr.io/databricks/cli:${{ steps.version.outputs.version }}-amd64" \ |
| 82 | + --push . |
| 83 | + rm databricks |
| 84 | +
|
| 85 | + - name: Build and push arm64 image |
| 86 | + run: | |
| 87 | + cp /tmp/cli_arm64/databricks ./databricks |
| 88 | + docker buildx build \ |
| 89 | + --platform linux/arm64 \ |
| 90 | + --build-arg ARCH=arm64 \ |
| 91 | + --tag "ghcr.io/databricks/cli:${{ steps.version.outputs.version }}-arm64" \ |
| 92 | + --push . |
| 93 | + rm databricks |
| 94 | +
|
| 95 | + - name: Create and push version-pinned multi-arch manifest |
| 96 | + run: | |
| 97 | + docker buildx imagetools create \ |
| 98 | + --tag "ghcr.io/databricks/cli:${{ steps.version.outputs.version }}" \ |
| 99 | + "ghcr.io/databricks/cli:${{ steps.version.outputs.version }}-amd64" \ |
| 100 | + "ghcr.io/databricks/cli:${{ steps.version.outputs.version }}-arm64" |
| 101 | +
|
| 102 | + - name: Update latest multi-arch manifest |
| 103 | + if: inputs.update_latest |
| 104 | + run: |- |
| 105 | + docker buildx imagetools create \ |
| 106 | + --tag ghcr.io/databricks/cli:latest-amd64 \ |
| 107 | + "ghcr.io/databricks/cli:${{ steps.version.outputs.version }}-amd64" |
| 108 | + docker buildx imagetools create \ |
| 109 | + --tag ghcr.io/databricks/cli:latest-arm64 \ |
| 110 | + "ghcr.io/databricks/cli:${{ steps.version.outputs.version }}-arm64" |
| 111 | + docker buildx imagetools create \ |
| 112 | + --tag ghcr.io/databricks/cli:latest \ |
| 113 | + "ghcr.io/databricks/cli:${{ steps.version.outputs.version }}-amd64" \ |
| 114 | + "ghcr.io/databricks/cli:${{ steps.version.outputs.version }}-arm64" |
0 commit comments