Skip to content

Commit 0edece6

Browse files
committed
feat: add Homebrew installation support
- Add Homebrew install section to README.md, README.zh.md, README.ja.md - Add update-homebrew job in release.yml to auto-generate and push formula to nashsu/homebrew-opencli-rs on each release
1 parent 01232db commit 0edece6

6 files changed

Lines changed: 104 additions & 0 deletions

File tree

.DS_Store

-6 KB
Binary file not shown.

.github/workflows/release.yml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,3 +140,84 @@ jobs:
140140
artifacts/opencli-rs-*.zip
141141
artifacts/opencli-rs-chrome-extension.zip
142142
artifacts/SHA256SUMS.txt
143+
144+
update-homebrew:
145+
name: Update Homebrew Formula
146+
needs: [release]
147+
runs-on: ubuntu-latest
148+
steps:
149+
- name: Download artifacts
150+
uses: actions/download-artifact@v4
151+
with:
152+
pattern: opencli-rs-*
153+
path: artifacts
154+
merge-multiple: true
155+
156+
- name: Checkout Homebrew tap
157+
uses: actions/checkout@v4
158+
with:
159+
repository: nashsu/homebrew-opencli-rs
160+
token: ${{ secrets.HOMEBREW_TAP_TOKEN }}
161+
path: homebrew-tap
162+
163+
- name: Update formula
164+
run: |
165+
VERSION="${GITHUB_REF_NAME#v}"
166+
RELEASE_URL_BASE="https://github.com/nashsu/opencli-rs/releases/download/v${VERSION}"
167+
SHA_MACOS_ARM=$(sha256sum artifacts/opencli-rs-aarch64-apple-darwin.tar.gz | awk '{print $1}')
168+
SHA_MACOS_INTEL=$(sha256sum artifacts/opencli-rs-x86_64-apple-darwin.tar.gz | awk '{print $1}')
169+
SHA_LINUX_ARM=$(sha256sum artifacts/opencli-rs-aarch64-unknown-linux-musl.tar.gz | awk '{print $1}')
170+
SHA_LINUX_INTEL=$(sha256sum artifacts/opencli-rs-x86_64-unknown-linux-musl.tar.gz | awk '{print $1}')
171+
172+
mkdir -p homebrew-tap/Formula
173+
cat > homebrew-tap/Formula/opencli-rs.rb <<FORMULA
174+
class OpencliRs < Formula
175+
desc "AI-powered CLI for fetching information from any website"
176+
homepage "https://github.com/nashsu/opencli-rs"
177+
version "${VERSION}"
178+
license "Apache-2.0"
179+
180+
on_macos do
181+
on_arm do
182+
url "${RELEASE_URL_BASE}/opencli-rs-aarch64-apple-darwin.tar.gz"
183+
sha256 "${SHA_MACOS_ARM}"
184+
end
185+
on_intel do
186+
url "${RELEASE_URL_BASE}/opencli-rs-x86_64-apple-darwin.tar.gz"
187+
sha256 "${SHA_MACOS_INTEL}"
188+
end
189+
end
190+
191+
on_linux do
192+
on_arm do
193+
url "${RELEASE_URL_BASE}/opencli-rs-aarch64-unknown-linux-musl.tar.gz"
194+
sha256 "${SHA_LINUX_ARM}"
195+
end
196+
on_intel do
197+
url "${RELEASE_URL_BASE}/opencli-rs-x86_64-unknown-linux-musl.tar.gz"
198+
sha256 "${SHA_LINUX_INTEL}"
199+
end
200+
end
201+
202+
def install
203+
bin.install "opencli-rs"
204+
end
205+
206+
test do
207+
assert_match version.to_s, shell_output("#{bin}/opencli-rs --version")
208+
end
209+
end
210+
FORMULA
211+
212+
echo "Updated formula to version ${VERSION}"
213+
cat homebrew-tap/Formula/opencli-rs.rb
214+
215+
- name: Commit and push to tap
216+
run: |
217+
cd homebrew-tap
218+
git config user.name "github-actions[bot]"
219+
git config user.email "github-actions[bot]@users.noreply.github.com"
220+
git add Formula/opencli-rs.rb
221+
git diff --cached --quiet && echo "No changes" && exit 0
222+
git commit -m "Update opencli-rs to ${GITHUB_REF_NAME}"
223+
git push

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@
33
/opencli
44
test-results*.md
55
twitter-downloads/
6+
CLAUDE.md
7+
.DS_Store

README.ja.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,13 @@
4646
## インストール
4747
> **ファイルは1つだけ、ダウンロードすればすぐ使えます。** Node.js、Python やその他のランタイムは不要、PATH に配置するだけで実行可能。
4848
49+
### Homebrew(macOS / Linux)
50+
51+
```bash
52+
brew tap nashsu/opencli-rs
53+
brew install opencli-rs
54+
```
55+
4956
### ワンライナーインストールスクリプト(macOS / Linux)
5057

5158
```bash

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,13 @@ A **complete rewrite in pure Rust** based on [OpenCLI](https://github.com/jackwe
5656
## Installation
5757
> **Just one file, download and use.** No Node.js, Python, or any runtime needed — just put it in your PATH and go.
5858
59+
### Homebrew (macOS / Linux)
60+
61+
```bash
62+
brew tap nashsu/opencli-rs
63+
brew install opencli-rs
64+
```
65+
5966
### One-line Install Script (macOS / Linux)
6067

6168
```bash

README.zh.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,13 @@
5757
## 安装
5858
> **只有一个文件,下载即可使用。** 无需 Node.js、Python 或任何运行时,放到 PATH 里就能跑。
5959
60+
### Homebrew(macOS / Linux)
61+
62+
```bash
63+
brew tap nashsu/opencli-rs
64+
brew install opencli-rs
65+
```
66+
6067
### 一键安装脚本(macOS / Linux)
6168

6269
```bash

0 commit comments

Comments
 (0)