diff --git a/.github/workflows/release-shared.yml b/.github/workflows/release-shared.yml index aed96350a..4443f80cb 100644 --- a/.github/workflows/release-shared.yml +++ b/.github/workflows/release-shared.yml @@ -49,6 +49,9 @@ jobs: env: BUN_SHELL: ${{ inputs.shell }} VERSION: ${{ inputs.version }} + SENTRY_DSN: ${{ secrets.SENTRY_DSN }} + POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }} + POSTHOG_ENDPOINT: ${{ secrets.POSTHOG_ENDPOINT }} steps: - name: Checkout uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 diff --git a/apps/cli/scripts/build.ts b/apps/cli/scripts/build.ts index 524cae04b..07cca0def 100644 --- a/apps/cli/scripts/build.ts +++ b/apps/cli/scripts/build.ts @@ -125,7 +125,20 @@ async function buildGoTarget(target: (typeof TARGETS)[number]) { const outfile = path.join(binDir, `supabase-go${target.ext}`); console.log(`[${target.pkg}] Compiling Go CLI (${goos}/${goarch})...`); - const goLdflags = `-s -w -X github.com/supabase/cli/internal/utils.Version=${version}`; + const ldflagParts = ["-s", "-w", `-X github.com/supabase/cli/internal/utils.Version=${version}`]; + const { SENTRY_DSN, POSTHOG_API_KEY, POSTHOG_ENDPOINT } = process.env; + if (SENTRY_DSN) { + ldflagParts.push(`-X github.com/supabase/cli/internal/utils.SentryDsn=${SENTRY_DSN}`); + } + if (POSTHOG_API_KEY) { + ldflagParts.push(`-X github.com/supabase/cli/internal/utils.PostHogAPIKey=${POSTHOG_API_KEY}`); + } + if (POSTHOG_ENDPOINT) { + ldflagParts.push( + `-X github.com/supabase/cli/internal/utils.PostHogEndpoint=${POSTHOG_ENDPOINT}`, + ); + } + const goLdflags = ldflagParts.join(" "); await $`go build -trimpath -ldflags=${goLdflags} -o ${outfile} .`.cwd(goSource).env({ ...process.env, GOOS: goos,