Skip to content

Commit 3639f67

Browse files
committed
fix: homebrew packaging
- Adjusted Homebrew cask to use custom_block for shell completions - Ensured bash, zsh, and fish completions are generated and installed - Improved compatibility with Homebrew packaging requirements Fixes #2182 Jira: https://issues.redhat.com/browse/SRVKP-8197 Signed-off-by: Chmouel Boudjnah <[email protected]>
1 parent 8e74f14 commit 3639f67

File tree

1 file changed

+22
-10
lines changed

1 file changed

+22
-10
lines changed

.goreleaser.yml

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ archives:
3838
{{- else }}{{ .Arch }}{{ end }}
3939
format_overrides:
4040
- goos: windows
41-
- formats: zip
41+
formats: ["zip"]
42+
- goos: darwin
43+
formats: ["zip"]
4244
checksum:
4345
name_template: "checksums.txt"
4446
snapshot:
@@ -84,15 +86,25 @@ homebrew_casks:
8486
- formula: git
8587
homepage: "https://pipelinesascode.com"
8688
description: tkn-pac - A command line interface for interacting with Pipelines as Code
87-
hooks:
88-
pre:
89-
install: |
90-
bin.install "tkn-pac" => "tkn-pac"
91-
output = Utils.popen_read("SHELL=bash #{bin}/tkn-pac completion bash")
92-
(bash_completion/"tkn-pac").write output
93-
output = Utils.popen_read("SHELL=zsh #{bin}/tkn-pac completion zsh")
94-
(zsh_completion/"_tkn-pac").write output
95-
prefix.install_metafiles
89+
binary: "tkn-pac"
90+
custom_block: |
91+
zsh_completion = "#{staged_path}/_tkn-pac"
92+
bash_completion = "#{staged_path}/tkn-pac.bash"
93+
fish_completion = "#{staged_path}/tkn-pac.fish"
94+
95+
preflight do
96+
stdout, * = system_command "#{staged_path}/tkn-pac", args: ["completion", "bash"]
97+
File.write bash_completion, stdout
98+
stdout, * = system_command "#{staged_path}/tkn-pac", args: ["completion", "zsh"]
99+
File.write zsh_completion, stdout
100+
stdout, * = system_command "#{staged_path}/tkn-pac", args: ["completion", "fish"]
101+
File.write fish_completion, stdout
102+
end
103+
104+
binary zsh_completion, target: "#{HOMEBREW_PREFIX}/share/zsh/site-functions/_tkn-pac"
105+
binary bash_completion, target: "#{HOMEBREW_PREFIX}/etc/bash_completion.d/tkn-pac"
106+
binary fish_completion, target: "#{HOMEBREW_PREFIX}/share/fish/vendor_completions.d/tkn-pac.fish"
107+
96108
nfpms:
97109
- file_name_template: >-
98110
tkn-pac-

0 commit comments

Comments
 (0)