Skip to content

feat: dedicated CLI release workflow (macOS binaries + Linux docker)#16

Closed
d-g-town wants to merge 1 commit into
mainfrom
dgtown/cli-macos-builds
Closed

feat: dedicated CLI release workflow (macOS binaries + Linux docker)#16
d-g-town wants to merge 1 commit into
mainfrom
dgtown/cli-macos-builds

Conversation

@d-g-town
Copy link
Copy Markdown
Contributor

@d-g-town d-g-town commented Jun 2, 2026

Why

legacy-backend/cli/.goreleaser.yaml now builds the darwin targets with CGO_ENABLED=1 so 99designs/keyring can use the real macOS Keychain backend (gated behind //go:build darwin && cgo). darwin+CGO can't cross-compile from Linux, so the shared single-Linux-job release-from-tag.yaml would fail on the next porter-v* tag.

A macOS runner, by contrast, can build every binary target — darwin natively with CGO, and linux/windows via pure-Go CGO_ENABLED=0 cross-compile. The only thing it can't do is build the linux Docker image (no Docker daemon). So this runs the whole goreleaser release on macOS and moves only the image to a Linux job. No goreleaser Pro.

Jobs

  • build-binaries (macos-15-large): goreleaser release --clean --parallelism=4 --skip=validate — all binaries, archives, checksums, R2 blobs (goreleaser's native S3 uploader), Homebrew formula, and the GitHub release.
  • build-docker (ubuntu-latest, needs: build-binaries): builds the linux/amd64 binary (CGO_ENABLED=0), the porter-cli image, and recreates the :<ver> / :latest manifests the old docker_manifests pipe produced. Publishes the R2 latest pointer here too (macOS runners don't ship the AWS CLI).

Notes

  • GHCR login uses secrets.GITHUB_TOKEN, matching the proven shared workflow — the app-token variant (use GitHub app token for GHCR push #14) was reverted in 97ad992.
  • Image tags strip the leading v (tagVersion=v1.2.31.2.3-amd64 / 1.2.3 / latest) to match what goreleaser's {{ .Version }} produced.
  • The shared release-from-tag.yaml is untouched — monolith/agent releases are unaffected.

Companion change

Depends on porter-dev/code#5903, which removes the dockers:/docker_manifests: sections from the CLI's .goreleaser.yaml and routes porter-v* tags here. Both must ship together — this workflow only works at a code tag that has those goreleaser sections removed.

First-run verification

  • darwin arm64+amd64 binaries open the macOS Keychain (proves CGO linked, not the file fallback).
  • linux/windows binaries + checksums + R2 blobs + Homebrew + GitHub release from the macOS job.
  • porter-cli image + :latest/:version manifests from the Linux job; latest pointer updated.
  • darwin/arm64 CGO cross-compile from the Intel macos-15-large host (relies on the universal macOS SDK).

🤖 Generated with Claude Code

The porter CLI now builds its darwin binaries with CGO_ENABLED=1 so
99designs/keyring can use the real macOS Keychain backend. darwin+CGO
can't cross-compile from Linux, so the shared release-from-tag.yaml
(single Linux job) would fail on the next porter-v* tag.

This adds a dedicated workflow:
- build-binaries (macos-15-large): full goreleaser release — darwin
  natively with CGO, linux/windows via pure-Go cross-compile, plus
  archives, checksums, R2 blobs, Homebrew formula, GitHub release.
- build-docker (ubuntu-latest, needs build-binaries): builds the
  linux/amd64 binary, the porter-cli image, and the :version/:latest
  manifests goreleaser's docker pipes used to produce. Also publishes
  the R2 latest pointer (macOS runners lack the AWS CLI).

GHCR login uses secrets.GITHUB_TOKEN, matching the proven shared
workflow (the app-token variant in #14 was reverted in 97ad992).
The shared release-from-tag.yaml is left untouched so monolith/agent
releases are unaffected.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@charlievieth
Copy link
Copy Markdown

charlievieth commented Jun 2, 2026

Cross-compilation for Darwin/macOS works on Linux with this change since it only requires dynamically linking to the CoreFoundation and Security.framework libraries, which Go can do without the libraries being present on the machine where the Darwin binary is being built. A full explanation can be found here: https://github.com/porter-dev/code/pull/5903#issuecomment-4606008125.

CC: @d-g-town

@d-g-town d-g-town closed this Jun 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants