Ctrl K
ComunidadGuías…

goreleaser.yaml

Rama main · réplica de lectura del repositorio original.

Archivo original ↗Preguntar a KiBot
# GoReleaser configuration

release:
  # If the tag has a pre-release part (e.g. -beta1), this becomes a GitHub pre-release.
  prerelease: auto
  # Optional but useful; avoids accumulating duplicate draft releases.
  mode: replace
  # Release is published but not marked as latest until binaries and Docker image are ready.
  draft: false
  make_latest: false

archives:
  - id: default
    name_template: "{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}"
    builds:
      - keploy
      - keploy-windows
    format_overrides:
      - goos: windows
        format: binary

builds:
  - binary: keploy
    id: keploy
    main: ./main.go
    ldflags:
      - -s -w -X main.dsn={{.Env.SENTRY_DSN_BINARY}}
      - -s -w -X main.version={{.Version}}
      - -s -w -X main.apiServerURI={{.Env.SERVER_URL}}
      - -s -w -X main.gitHubClientID={{.Env.GITHUB_APP_CLIENT_ID}}
    # pg_query_go / libpg_query requires cgo. The release itself does not
    # run goreleaser: .github/workflows/release.yml builds each platform on
    # its own native runner, the linux binaries with
    # .github/scripts/linux/build-linux-release.sh. This file mirrors it for
    # local snapshot builds and as the ldflags source of truth.
    #
    # linux: FULLY STATIC against musl, linked by zig cc (the overrides
    # below; KEPLOY_ZIG names the zig, .github/scripts/linux/zig-toolchain.sh
    # stages the pinned one). Linked against the build host's glibc,
    # v3.6.164 needed GLIBC_2.34 and exited at once on Debian 11, Ubuntu
    # 20.04, RHEL 8 and Amazon Linux 2. netgo and osusergo keep DNS and user
    # lookups pure Go (a static binary cannot load the host's NSS modules);
    # -static and -z stack-size are pins: zig's musl target already links
    # static with a 16 MiB PT_GNU_STACK, and musl caps a thread at 8 MiB, so
    # 8 MiB keeps glibc's default thread stack if zig's defaults change (the
    # Postgres parser's C code recurses on the calling thread's stack; a
    # 128 KiB header crashes it at 300 levels of nesting); --strip-all
    # because zig cc does not act on -s.
    env:
      - CGO_ENABLED=1
    goos:
      - linux
      - darwin
      - windows
    goarch:
      - amd64
      - arm64
    # macOS ships as darwin/arm64 only (Apple silicon); the amd64 leg is
    # not built anywhere. Signing/notarization of the darwin binary is
    # done by gon in .github/workflows/release.yml, not here — this
    # config has no universal_binaries block and no darwin post hook.
    ignore:
      - goos: windows
        goarch: amd64
      - goos: darwin
        goarch: amd64
    tags:
      - viper_bind_struct
    overrides:
      - goos: linux
        goarch: amd64
        env:
          - CGO_ENABLED=1
          - CC={{ envOrDefault "KEPLOY_ZIG" "zig" }} cc -target x86_64-linux-musl
        ldflags:
          - -s -w -X main.dsn={{.Env.SENTRY_DSN_BINARY}}
          - -s -w -X main.version={{.Version}}
          - -s -w -X main.apiServerURI={{.Env.SERVER_URL}}
          - -s -w -X main.gitHubClientID={{.Env.GITHUB_APP_CLIENT_ID}}
          - -linkmode=external -extldflags '-static -Wl,-z,stack-size=8388608 -Wl,--strip-all'
        tags:
          - viper_bind_struct
          - netgo
          - osusergo
      - goos: linux
        goarch: arm64
        env:
          - CGO_ENABLED=1
          - CC={{ envOrDefault "KEPLOY_ZIG" "zig" }} cc -target aarch64-linux-musl
        ldflags:
          - -s -w -X main.dsn={{.Env.SENTRY_DSN_BINARY}}
          - -s -w -X main.version={{.Version}}
          - -s -w -X main.apiServerURI={{.Env.SERVER_URL}}
          - -s -w -X main.gitHubClientID={{.Env.GITHUB_APP_CLIENT_ID}}
          - -linkmode=external -extldflags '-static -Wl,-z,stack-size=8388608 -Wl,--strip-all'
        tags:
          - viper_bind_struct
          - netgo
          - osusergo

  # Docker image binaries. Separate from the public linux binaries
  # above because the docker image reports crashes to a distinct
  # Sentry project (SENTRY_DSN_DOCKER) so telemetry from containerised
  # and self-hosted users stays disentangled. Not added to any
  # archive — the binaries live in dist/ for the docker-release job
  # to consume via `Dockerfile.runtime`.
  #
  # cgo for pg_query_go, linked static against musl as the keploy build's
  # linux targets are (see there).
  - binary: keploy
    id: keploy-docker
    main: ./main.go
    ldflags:
      - -s -w -X main.dsn={{.Env.SENTRY_DSN_DOCKER}}
      - -s -w -X main.version={{.Version}}
      - -s -w -X main.apiServerURI={{.Env.SERVER_URL}}
      - -s -w -X main.gitHubClientID={{.Env.GITHUB_APP_CLIENT_ID}}
    env:
      - CGO_ENABLED=1
    goos:
      - linux
    goarch:
      - amd64
      - arm64
    tags:
      - viper_bind_struct
    overrides:
      - goos: linux
        goarch: amd64
        env:
          - CGO_ENABLED=1
          - CC={{ envOrDefault "KEPLOY_ZIG" "zig" }} cc -target x86_64-linux-musl
        ldflags:
          - -s -w -X main.dsn={{.Env.SENTRY_DSN_DOCKER}}
          - -s -w -X main.version={{.Version}}
          - -s -w -X main.apiServerURI={{.Env.SERVER_URL}}
          - -s -w -X main.gitHubClientID={{.Env.GITHUB_APP_CLIENT_ID}}
          - -linkmode=external -extldflags '-static -Wl,-z,stack-size=8388608 -Wl,--strip-all'
        tags:
          - viper_bind_struct
          - netgo
          - osusergo
      - goos: linux
        goarch: arm64
        env:
          - CGO_ENABLED=1
          - CC={{ envOrDefault "KEPLOY_ZIG" "zig" }} cc -target aarch64-linux-musl
        ldflags:
          - -s -w -X main.dsn={{.Env.SENTRY_DSN_DOCKER}}
          - -s -w -X main.version={{.Version}}
          - -s -w -X main.apiServerURI={{.Env.SERVER_URL}}
          - -s -w -X main.gitHubClientID={{.Env.GITHUB_APP_CLIENT_ID}}
          - -linkmode=external -extldflags '-static -Wl,-z,stack-size=8388608 -Wl,--strip-all'
        tags:
          - viper_bind_struct
          - netgo
          - osusergo

  - binary: keploy
    id: keploy-windows
    main: ./main.go
    ldflags:
      - -s -w -X main.dsn={{.Env.SENTRY_DSN_BINARY}}
      - -s -w -X main.version={{.Version}}
      - -s -w -X main.apiServerURI={{.Env.SERVER_URL}}
      - -s -w -X main.gitHubClientID={{.Env.GITHUB_APP_CLIENT_ID}}
    # Still cgo, but no longer for the interception backend — that is pure Go
    # now. The Postgres integration pulls pg_query_go, which embeds the
    # Postgres parser in C, so the mingw cross-toolchain stays.
    env:
      - CGO_ENABLED=1
      - CC=x86_64-w64-mingw32-gcc
      - CXX=x86_64-w64-mingw32-g++
    goos:
      - windows
    goarch:
      - amd64
    tags:
      - viper_bind_struct