Skip to content

Commit

Permalink
goreleaser: refactor brew formula
Browse files Browse the repository at this point in the history
Fixes #1909
  • Loading branch information
jzelinskie committed May 23, 2024
1 parent e255b56 commit e33904d
Showing 1 changed file with 31 additions and 60 deletions.
91 changes: 31 additions & 60 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,67 +74,38 @@ snapcrafts:
- "network"
brews:
- name: "{{.ProjectName}}"
repository:
owner: "authzed"
name: "homebrew-tap"
token: "{{ .Env.HOMEBREW_TAP_GITHUB_TOKEN }}"
url_template: "https://github.com/authzed/spicedb/releases/download/{{ .Tag }}/{{ .ArtifactName }}"
download_strategy: "CurlDownloadStrategy"
commit_author:
name: "authzedbot"
email: "infrastructure@authzed.com"
commit_msg_template: "Brew formula update for {{ .ProjectName }} version {{ .Tag }}"
homepage: "https://authzed.com/"
description: "SpiceDB is a Zanzibar-inspired database that stores, computes, and validates application permissions."
license: "Apache-2.0"
directory: "Formula"
skip_upload: "auto"
custom_block: |
head "https://github.com/authzed/spicedb.git", :branch => "main"
dependencies:
- name: "go"
type: "build"
test: |
system "#{bin}/spicedb version"
install: |
if !File.exists? "spicedb"
system "go build --ldflags \"-s -w -X github.com/jzelinskie/cobrautil/v2.Version=$(git describe --always --abbrev=7 --dirty --tags)\" ./cmd/spicedb"
end
bin.install "spicedb"
(bash_completion/"spicedb").write Utils.safe_popen_read("#{bin}/spicedb", "completion", "bash")
(zsh_completion/"_spicedb").write Utils.safe_popen_read("#{bin}/spicedb", "completion", "zsh")
(fish_completion/"spicedb.fish").write Utils.safe_popen_read("#{bin}/spicedb", "completion", "fish")
<<: &brew-shared
description: "Google Zanzibar-inspired permissions database for fine-grained access control"
homepage: "https://github.com/authzed/spicedb"
license: "Apache-2.0"
dependencies:
- name: "go"
type: "build"
custom_block: |
head "https://github.com/authzed/spicedb.git", :branch => "main"
url_template: "https://github.com/authzed/spicedb/releases/download/{{ .Tag }}/{{ .ArtifactName }}"
install: |
unless File.exist? "spicedb"
versionVar = "github.com/jzelinskie/cobrautil/v2.Version"
versionCmd = "$(git describe --always --abbrev=7 --dirty --tags)"
system "go build --ldflags '-s -w -X #{versionVar}=#{versionCmd}' ./cmd/spicedb"
end
bin.install "spicedb"
generate_completions_from_executable(bin/"spicedb", "completion", shells: [:bash, :zsh, :fish])
test: |
system "#{bin}/spicedb version"
repository:
owner: "authzed"
name: "homebrew-tap"
token: "{{ .Env.HOMEBREW_TAP_GITHUB_TOKEN }}"
commit_author:
name: "authzedbot"
email: "[email protected]"
commit_msg_template: "Brew formula update for {{ .ProjectName }} version {{ .Tag }}"
directory: "Formula"
skip_upload: "auto"
- name: "{{.ProjectName}}@{{.Version}}"
repository:
owner: "authzed"
name: "homebrew-tap"
token: "{{ .Env.HOMEBREW_TAP_GITHUB_TOKEN }}"
url_template: "https://github.com/authzed/spicedb/releases/download/{{ .Tag }}/{{ .ArtifactName }}"
download_strategy: "CurlDownloadStrategy"
commit_author:
name: "authzedbot"
email: "[email protected]"
commit_msg_template: "Brew formula update for {{ .ProjectName }} version {{ .Tag }}"
homepage: "https://authzed.com/"
description: "SpiceDB is a Zanzibar-inspired database that stores, computes, and validates application permissions."
license: "Apache-2.0"
directory: "Formula"
skip_upload: "auto"
custom_block: |
head "https://github.com/authzed/spicedb.git", :branch => "main"
dependencies:
- name: "go"
type: "build"
test: |
system "#{bin}/spicedb version"
install: |
if !File.exists? "spicedb"
system "go build --ldflags \"-s -w -X github.com/jzelinskie/cobrautil/v2.Version=$(git describe --always --abbrev=7 --dirty --tags)\" ./cmd/spicedb"
end
bin.install "spicedb"
bash_completion.install "completions/spicedb.bash" => "spicedb"
zsh_completion.install "completions/spicedb.zsh" => "_spicedb"
fish_completion.install "completions/spicedb.fish"
<<: *brew-shared
dockers:
# AMD64
- image_templates:
Expand Down

0 comments on commit e33904d

Please sign in to comment.