Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,23 @@ changelog:
use: github-native
release:
prerelease: auto
brews:
homebrew_casks:
- repository:
owner: howar31
name: homebrew-tap
token: "{{ .Env.HOMEBREW_TAP_TOKEN }}"
directory: Formula
# Do not push the formula on prereleases (tags containing "-");
# otherwise goreleaser would overwrite the stable tap formula with the
# prerelease, since the npm-only guard in release.yml does not cover brews.
directory: Casks
# Do not push the cask on prereleases (tags containing "-");
# otherwise goreleaser would overwrite the stable tap cask with the
# prerelease, since the npm-only guard in release.yml does not cover casks.
skip_upload: "auto"
description: Agent-facing Discord CLI for AI agents.
license: MIT
homepage: https://github.com/howar31/dscrd
test: |
assert_match version.to_s, shell_output("#{bin}/dscrd --version")
# The release binaries are unsigned; strip the quarantine attribute so
# macOS Gatekeeper does not block the installed binary.
hooks:
post:
install: |
if system_command("/usr/bin/xattr", args: ["-h"]).exit_status == 0
system_command "/usr/bin/xattr", args: ["-dr", "com.apple.quarantine", "#{staged_path}/dscrd"]
end
Comment on lines +40 to +42

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Using system_command to check for the existence of /usr/bin/xattr by running it with -h is unnecessary and can cause issues. On macOS, /usr/bin/xattr is a standard system utility that is guaranteed to exist. Furthermore, running /usr/bin/xattr -h prints help/usage text to the console, which clutters the Homebrew installation logs. If the command were somehow missing or failed to execute, system_command would raise an exception (such as Errno::ENOENT) rather than returning a non-zero exit status, causing the installation to crash.

Using the standard OS.mac? check is the idiomatic and recommended approach in Homebrew Casks (and GoReleaser's documentation) to guard macOS-specific commands.

          if OS.mac?
            system_command "/usr/bin/xattr", args: ["-dr", "com.apple.quarantine", "#{staged_path}/dscrd"]
          end

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ dscrd operates as a **Discord bot** — the only automation model Discord's Term
# npm (downloads the platform binary, verifies SHA256)
npm install -g @howar31/dscrd

# or Homebrew
# or Homebrew (macOS)
brew install howar31/tap/dscrd

# or Go
Expand Down