Skip to content

Commit f8ea182

Browse files
committed
Homebrew tap setup.
1 parent 6bac38c commit f8ea182

3 files changed

Lines changed: 74 additions & 21 deletions

File tree

AGENTS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
# Agent Instructions
22

33
- At the end of every code change, run `vp build` so the built files are refreshed for local testing.
4+
- When asked to update the Homebrew tap after a signed macOS build, use the signed zip from `out/make/zip/darwin/arm64/Codiff-darwin-arm64-<version>.zip`, make sure the matching `v<version>` GitHub Release asset exists and downloads from `https://github.com/nkzw-tech/codiff/releases/download/v<version>/Codiff-darwin-arm64-<version>.zip`, update `nkzw-tech/homebrew-tap` (`Casks/codiff.rb`) with the new `version` and SHA-256, then run `brew audit --cask nkzw-tech/tap/codiff` and `brew style --cask nkzw-tech/tap/codiff` through the tapped checkout before pushing.

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ Codiff is a beautiful, minimal, local diff viewer for reviewing staged and unsta
1212

1313
## Download
1414

15+
Install with Homebrew:
16+
17+
```bash
18+
brew install --cask nkzw-tech/tap/codiff
19+
```
20+
1521
Download the latest Codiff app from [GitHub Releases](https://github.com/nkzw-tech/codiff/releases).
1622

1723
After installing the app, run `Codiff > Install Terminal Helper` to make the `codiff` command available in your shell.

docs/distribution.md

Lines changed: 67 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -52,52 +52,100 @@ These parts are app-specific:
5252

5353
Use a cask, not a formula, because Codiff is a prebuilt macOS `.app` bundle.
5454

55-
Create a tap repository:
55+
The tap lives at <https://github.com/nkzw-tech/homebrew-tap>. Users can install
56+
Codiff with:
5657

5758
```sh
58-
gh repo create cpojer/homebrew-tap --public --clone
59-
cd homebrew-tap
60-
mkdir -p Casks
59+
brew install --cask nkzw-tech/tap/codiff
6160
```
6261

63-
After building the mac app, upload `out/make/zip/darwin/arm64/Codiff-darwin-arm64-*.zip` to a stable release URL, for example a GitHub Release in the Codiff repository. Compute its checksum:
62+
Or tap the repository first:
6463

6564
```sh
66-
shasum -a 256 Codiff-darwin-arm64-0.0.1.zip
65+
brew tap nkzw-tech/tap
66+
brew install --cask codiff
67+
```
68+
69+
### Manual Release Flow
70+
71+
Build, sign, and notarize the macOS app locally. The signed zip should be in:
72+
73+
```sh
74+
out/make/zip/darwin/arm64/Codiff-darwin-arm64-<version>.zip
75+
```
76+
77+
The zip must also be uploaded to the matching GitHub Release in
78+
`nkzw-tech/codiff` and be available at the stable public URL:
79+
80+
```sh
81+
https://github.com/nkzw-tech/codiff/releases/download/v<version>/Codiff-darwin-arm64-<version>.zip
82+
```
83+
84+
If the release is still a draft, publish it before updating the tap:
85+
86+
```sh
87+
gh release edit v<version> --repo nkzw-tech/codiff --draft=false --latest --title v<version>
6788
```
6889

69-
Create `Casks/codiff.rb`:
90+
Verify the release asset URL and checksum:
91+
92+
```sh
93+
curl -L --fail --output /tmp/Codiff-darwin-arm64-<version>.zip \
94+
https://github.com/nkzw-tech/codiff/releases/download/v<version>/Codiff-darwin-arm64-<version>.zip
95+
shasum -a 256 out/make/zip/darwin/arm64/Codiff-darwin-arm64-<version>.zip
96+
shasum -a 256 /tmp/Codiff-darwin-arm64-<version>.zip
97+
```
98+
99+
Update `Casks/codiff.rb` in `nkzw-tech/homebrew-tap` with the new `version`
100+
and `sha256`:
70101

71102
```ruby
72103
cask "codiff" do
73-
version "0.0.1"
74-
sha256 "REPLACE_WITH_SHA256"
104+
version "0.2.0"
105+
sha256 "6fa3d5e723a1f768bbb81e16f7c05bd3e6559a53fd48a6d1aa2f5093ddce10db"
75106

76-
url "https://github.com/cpojer/codiff/releases/download/v#{version}/Codiff-darwin-arm64-#{version}.zip"
107+
url "https://github.com/nkzw-tech/codiff/releases/download/v#{version}/Codiff-darwin-arm64-#{version}.zip"
77108
name "Codiff"
78-
desc "Local code review diff viewer"
79-
homepage "https://github.com/cpojer/codiff"
109+
desc "Visual diff tool for Git changes"
110+
homepage "https://github.com/nkzw-tech/codiff"
111+
112+
livecheck do
113+
url :url
114+
strategy :github_latest
115+
end
116+
80117
depends_on arch: :arm64
118+
depends_on macos: :big_sur
81119

82120
app "Codiff.app"
83-
binary "#{appdir}/Codiff.app/Contents/Resources/app/bin/codiff-app", target: "codiff"
121+
binary "#{appdir}/Codiff.app/Contents/Resources/app/bin/codiff-app",
122+
target: "codiff"
123+
124+
zap trash: [
125+
"~/Library/Application Support/Codiff",
126+
"~/Library/Preferences/dev.nkzw-tech.codiff.plist",
127+
"~/Library/Saved Application State/dev.nkzw-tech.codiff.savedState",
128+
]
84129
end
85130
```
86131

87-
Commit and push:
132+
Commit and push the tap update:
88133

89134
```sh
90135
git add Casks/codiff.rb
91-
git commit -m "Add Codiff cask"
136+
git commit -m "Update Codiff cask to <version>"
92137
git push
93138
```
94139

95-
Users can install it with either command:
140+
After pushing, verify Homebrew sees the new version:
96141

97142
```sh
98-
brew install --cask cpojer/tap/codiff
99-
brew tap cpojer/tap
100-
brew install --cask codiff
143+
brew tap nkzw-tech/tap
144+
git -C "$(brew --repository nkzw-tech/tap)" pull --ff-only
145+
brew audit --cask nkzw-tech/tap/codiff
146+
brew style --cask nkzw-tech/tap/codiff
147+
brew info --cask nkzw-tech/tap/codiff
148+
brew upgrade --cask codiff
101149
```
102150

103151
The cask symlinks Codiff's packaged terminal helper as `codiff`. Running
@@ -108,5 +156,3 @@ attached to the Electron process.
108156
Users who install the `.app` directly can run `Codiff > Install Terminal Helper`
109157
from the app menu. Codiff installs the helper into the first writable location
110158
from `/opt/homebrew/bin`, `/usr/local/bin`, and `~/.local/bin`.
111-
112-
For updates, upload a new zip, update `version` and `sha256`, commit, and push.

0 commit comments

Comments
 (0)