-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup-tap.sh
More file actions
executable file
·54 lines (48 loc) · 1.61 KB
/
Copy pathsetup-tap.sh
File metadata and controls
executable file
·54 lines (48 loc) · 1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/env bash
# Create the Homebrew tap so `brew install zainulabidin302/tap/datasip` works.
# Prereq: run ./ship.sh first (so the v0.1.0 tag contains the Go source).
# Needs: gh (authed), curl, shasum.
set -euo pipefail
OWNER=zainulabidin302
VER=v0.1.0
TARBALL="https://github.com/$OWNER/datasip/archive/refs/tags/$VER.tar.gz"
echo "→ fetching release tarball to checksum it…"
tmpf="$(mktemp)"
curl -fsSL "$TARBALL" -o "$tmpf"
if ! tar tzf "$tmpf" | grep -q '/main\.go$'; then
echo "✗ $VER tarball has no Go source. Run ./ship.sh first to update the tag, then re-run this."
exit 1
fi
SHA="$(shasum -a 256 "$tmpf" | awk '{print $1}')"
echo " sha256: $SHA"
work="$(mktemp -d)"; cd "$work"
if gh repo view "$OWNER/homebrew-tap" >/dev/null 2>&1; then
gh repo clone "$OWNER/homebrew-tap"
else
gh repo create "$OWNER/homebrew-tap" --public --clone \
--description "Homebrew tap for datasip"
fi
cd homebrew-tap
mkdir -p Formula
cat > Formula/datasip.rb <<RUBY
class Datasip < Formula
desc "See which app is eating your data - live, per-app, over any time window"
homepage "https://github.com/$OWNER/datasip"
url "$TARBALL"
sha256 "$SHA"
license "MIT"
head "https://github.com/$OWNER/datasip.git", branch: "main"
depends_on "go" => :build
def install
system "go", "build", *std_go_args(ldflags: "-s -w"), "."
end
test do
assert_match "datasip", shell_output("#{bin}/datasip version")
end
end
RUBY
git add -A
git commit -m "datasip $VER" >/dev/null 2>&1 || echo "(formula already up to date)"
git branch -M main
git push -u origin main
echo "✓ tap published. Now: brew install $OWNER/tap/datasip"