Skip to content

Commit a96144f

Browse files
committed
Consolidate goreleaser config into .goreleaser-release.yaml
Single config with two build IDs (unix/windows), full ldflags via YAML anchors, and jsign signing hook that's a no-op when JSIGN_JAR is unset. Still uses dummy binary for fast iteration. When ready, remove the `main:` field and this becomes the production release config. Co-authored-by: Isaac
1 parent 67b1ef9 commit a96144f

File tree

3 files changed

+90
-48
lines changed

3 files changed

+90
-48
lines changed

.github/workflows/release-test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
go-version-file: go.mod
4141
cache-dependency-path: |
4242
go.sum
43-
.goreleaser-test.yaml
43+
.goreleaser-release.yaml
4444
4545
- name: Configure Go module proxy via JFrog
4646
run: jf goc --repo-resolve=db-golang
@@ -77,7 +77,7 @@ jobs:
7777
uses: goreleaser/goreleaser-action@ec59f474b9834571250b370d4735c50f8e2d1e29 # v7.0.0
7878
with:
7979
version: ~> v2
80-
args: release -f .goreleaser-test.yaml --snapshot
80+
args: release -f .goreleaser-release.yaml --snapshot
8181
env:
8282
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8383

.goreleaser-release.yaml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
version: 2
2+
3+
before:
4+
hooks:
5+
- go mod download
6+
7+
builds:
8+
- id: unix
9+
main: ./.github/release-test
10+
env:
11+
- CGO_ENABLED=0
12+
mod_timestamp: '{{ .CommitTimestamp }}'
13+
flags:
14+
- -trimpath
15+
ldflags: &ldflags
16+
- '-s -w'
17+
- -X github.com/databricks/cli/internal/build.buildProjectName={{ .ProjectName }}
18+
- -X github.com/databricks/cli/internal/build.buildVersion={{ .Version }}
19+
20+
# Git information
21+
- -X github.com/databricks/cli/internal/build.buildBranch={{ .Branch }}
22+
- -X github.com/databricks/cli/internal/build.buildTag={{ .Tag }}
23+
- -X github.com/databricks/cli/internal/build.buildShortCommit={{ .ShortCommit }}
24+
- -X github.com/databricks/cli/internal/build.buildFullCommit={{ .FullCommit }}
25+
- -X github.com/databricks/cli/internal/build.buildCommitTimestamp={{ .CommitTimestamp }}
26+
- -X github.com/databricks/cli/internal/build.buildSummary={{ .Summary }}
27+
28+
# Version information
29+
- -X github.com/databricks/cli/internal/build.buildMajor={{ .Major }}
30+
- -X github.com/databricks/cli/internal/build.buildMinor={{ .Minor }}
31+
- -X github.com/databricks/cli/internal/build.buildPatch={{ .Patch }}
32+
- -X github.com/databricks/cli/internal/build.buildPrerelease={{ .Prerelease }}
33+
- -X github.com/databricks/cli/internal/build.buildIsSnapshot={{ .IsSnapshot }}
34+
- -X github.com/databricks/cli/internal/build.buildTimestamp={{ .Timestamp }}
35+
36+
goos:
37+
- linux
38+
- darwin
39+
goarch:
40+
- amd64
41+
- arm64
42+
binary: databricks
43+
44+
- id: windows
45+
main: ./.github/release-test
46+
env:
47+
- CGO_ENABLED=0
48+
mod_timestamp: '{{ .CommitTimestamp }}'
49+
flags:
50+
- -trimpath
51+
ldflags: *ldflags
52+
53+
goos:
54+
- windows
55+
goarch:
56+
- amd64
57+
- arm64
58+
binary: databricks
59+
60+
# Sign Windows binaries using jsign with Azure Key Vault.
61+
# When JSIGN_JAR is unset (e.g. snapshot builds), signing is skipped.
62+
# https://github.com/ebourg/jsign
63+
hooks:
64+
post:
65+
- bash -c 'test -z "${JSIGN_JAR}" && exit 0; java -jar "${JSIGN_JAR}" --storetype AZUREKEYVAULT --keystore deco-sign --storepass "${AZURE_VAULT_TOKEN}" --alias deco-sign --tsaurl http://timestamp.digicert.com "{{ .Path }}"'
66+
67+
archives:
68+
- formats: ["zip", "tar.gz"]
69+
70+
# Include version in archive only for release builds and not for snapshot builds.
71+
# Snapshot archives must have a stable file name such that the artifacts in the nightly
72+
# release are automatically overwritten. If the snapshot version is included in the
73+
# file name then additional logic to clean up older builds would be needed.
74+
name_template: 'databricks_cli_{{ if not .IsSnapshot }}{{ .Version }}_{{ end }}{{ .Os }}_{{ .Arch }}'
75+
76+
checksum:
77+
name_template: 'databricks_cli_{{ .Version }}_SHA256SUMS'
78+
algorithm: sha256
79+
80+
snapshot:
81+
version_template: '{{ incpatch .Version }}-dev+{{ .ShortCommit }}'
82+
83+
changelog:
84+
sort: asc
85+
filters:
86+
exclude:
87+
- '^docs:'
88+
- '^test:'

.goreleaser-test.yaml

Lines changed: 0 additions & 46 deletions
This file was deleted.

0 commit comments

Comments
 (0)