databricks-cli/.goreleaser.yaml

106 lines
3.4 KiB
YAML

version: 2
before:
hooks:
- go mod download
builds:
- env:
- CGO_ENABLED=0
mod_timestamp: '{{ .CommitTimestamp }}'
flags:
- -trimpath
ldflags:
- '-s -w'
- -X github.com/databricks/cli/internal/build.buildProjectName={{ .ProjectName }}
- -X github.com/databricks/cli/internal/build.buildVersion={{ .Version }}
# Git information
- -X github.com/databricks/cli/internal/build.buildBranch={{ .Branch }}
- -X github.com/databricks/cli/internal/build.buildTag={{ .Tag }}
- -X github.com/databricks/cli/internal/build.buildShortCommit={{ .ShortCommit }}
- -X github.com/databricks/cli/internal/build.buildFullCommit={{ .FullCommit }}
- -X github.com/databricks/cli/internal/build.buildCommitTimestamp={{ .CommitTimestamp }}
- -X github.com/databricks/cli/internal/build.buildSummary={{ .Summary }}
# Version information
- -X github.com/databricks/cli/internal/build.buildMajor={{ .Major }}
- -X github.com/databricks/cli/internal/build.buildMinor={{ .Minor }}
- -X github.com/databricks/cli/internal/build.buildPatch={{ .Patch }}
- -X github.com/databricks/cli/internal/build.buildPrerelease={{ .Prerelease }}
- -X github.com/databricks/cli/internal/build.buildIsSnapshot={{ .IsSnapshot }}
- -X github.com/databricks/cli/internal/build.buildTimestamp={{ .Timestamp }}
goos:
- windows
- linux
- darwin
goarch:
- amd64
- arm64
binary: databricks
archives:
- format: zip
# Include version in archive only for release builds and not for snapshot builds.
# Snapshot archives must have a stable file name such that the artifacts in the nightly
# release are automatically overwritten. If the snapshot version is included in the
# file name then additional logic to clean up older builds would be needed.
name_template: 'databricks_cli_{{ if not .IsSnapshot }}{{ .Version }}_{{ end }}{{ .Os }}_{{ .Arch }}'
dockers:
- id: arm64
goarch: arm64
# We need to use buildx to build arm64 image on a amd64 machine.
use: buildx
image_templates:
# Docker tags can't have "+" in them, so we replace it with "-"
- 'ghcr.io/databricks/cli:{{replace .Version "+" "-"}}-arm64'
- 'ghcr.io/databricks/cli:latest-arm64'
build_flag_templates:
- "--build-arg=ARCH=arm64"
- "--platform=linux/arm64"
extra_files:
- "./docker/config.tfrc"
- "./docker/setup.sh"
- id: amd64
goarch: amd64
use: buildx
image_templates:
# Docker tags can't have "+" in them, so we replace it with "-"
- 'ghcr.io/databricks/cli:{{replace .Version "+" "-"}}-amd64'
- 'ghcr.io/databricks/cli:latest-amd64'
build_flag_templates:
- "--build-arg=ARCH=amd64"
- "--platform=linux/amd64"
extra_files:
- "./docker/config.tfrc"
- "./docker/setup.sh"
docker_manifests:
- name_template: ghcr.io/databricks/cli:{{replace .Version "+" "-"}}
image_templates:
- ghcr.io/databricks/cli:{{replace .Version "+" "-"}}-amd64
- ghcr.io/databricks/cli:{{replace .Version "+" "-"}}-arm64
- name_template: ghcr.io/databricks/cli:latest
image_templates:
- ghcr.io/databricks/cli:latest-amd64
- ghcr.io/databricks/cli:latest-arm64
checksum:
name_template: 'databricks_cli_{{ .Version }}_SHA256SUMS'
algorithm: sha256
snapshot:
name_template: '{{ incpatch .Version }}-dev+{{ .ShortCommit }}'
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'