Skip to content

Commit 7e1376f

Browse files
Demwunzclaude
andcommitted
feat: add installation methods (homebrew, apt, shell script)
- Add GitHub Actions release workflow for multi-platform builds - Add install.sh for quick installation via curl - Add Homebrew formula template - Add homebrew-tap workflow for auto-updating formula - Update README with new installation options Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent e523d19 commit 7e1376f

5 files changed

Lines changed: 458 additions & 5 deletions

File tree

.github/workflows/release.yml

Lines changed: 190 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,190 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
permissions:
9+
contents: write
10+
11+
env:
12+
CARGO_TERM_COLOR: always
13+
14+
jobs:
15+
build:
16+
name: Build ${{ matrix.target }}
17+
runs-on: ${{ matrix.os }}
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
include:
22+
- target: x86_64-apple-darwin
23+
os: macos-latest
24+
artifact: cc-statusline-darwin-x86_64
25+
- target: aarch64-apple-darwin
26+
os: macos-latest
27+
artifact: cc-statusline-darwin-arm64
28+
- target: x86_64-unknown-linux-gnu
29+
os: ubuntu-latest
30+
artifact: cc-statusline-linux-x86_64
31+
- target: aarch64-unknown-linux-gnu
32+
os: ubuntu-latest
33+
artifact: cc-statusline-linux-arm64
34+
35+
steps:
36+
- uses: actions/checkout@v4
37+
38+
- name: Install Rust toolchain
39+
uses: dtolnay/rust-toolchain@stable
40+
with:
41+
targets: ${{ matrix.target }}
42+
43+
- name: Install cross-compilation tools (Linux ARM64)
44+
if: matrix.target == 'aarch64-unknown-linux-gnu'
45+
run: |
46+
sudo apt-get update
47+
sudo apt-get install -y gcc-aarch64-linux-gnu
48+
49+
- name: Build
50+
run: |
51+
if [ "${{ matrix.target }}" = "aarch64-unknown-linux-gnu" ]; then
52+
export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc
53+
fi
54+
cargo build --release --target ${{ matrix.target }}
55+
56+
- name: Package binary
57+
run: |
58+
mkdir -p dist
59+
cp target/${{ matrix.target }}/release/cc-statusline dist/${{ matrix.artifact }}
60+
cd dist && shasum -a 256 ${{ matrix.artifact }} > ${{ matrix.artifact }}.sha256
61+
62+
- name: Upload artifact
63+
uses: actions/upload-artifact@v4
64+
with:
65+
name: ${{ matrix.artifact }}
66+
path: dist/*
67+
68+
create-deb:
69+
name: Create .deb package
70+
runs-on: ubuntu-latest
71+
needs: build
72+
strategy:
73+
matrix:
74+
include:
75+
- artifact: cc-statusline-linux-x86_64
76+
arch: amd64
77+
- artifact: cc-statusline-linux-arm64
78+
arch: arm64
79+
80+
steps:
81+
- uses: actions/checkout@v4
82+
83+
- name: Download binary
84+
uses: actions/download-artifact@v4
85+
with:
86+
name: ${{ matrix.artifact }}
87+
path: bin
88+
89+
- name: Get version
90+
id: version
91+
run: echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
92+
93+
- name: Create .deb package
94+
run: |
95+
VERSION=${{ steps.version.outputs.version }}
96+
ARCH=${{ matrix.arch }}
97+
PKG_NAME=cc-statusline_${VERSION}_${ARCH}
98+
99+
mkdir -p ${PKG_NAME}/DEBIAN
100+
mkdir -p ${PKG_NAME}/usr/bin
101+
102+
chmod +x bin/${{ matrix.artifact }}
103+
cp bin/${{ matrix.artifact }} ${PKG_NAME}/usr/bin/cc-statusline
104+
105+
cat > ${PKG_NAME}/DEBIAN/control << EOF
106+
Package: cc-statusline
107+
Version: ${VERSION}
108+
Section: utils
109+
Priority: optional
110+
Architecture: ${ARCH}
111+
Maintainer: Fazal Khan
112+
Description: Lightweight statusline for Claude Code
113+
Shows context token usage and costs in a colored bar format.
114+
Homepage: https://github.com/Demwunz/cc-statusline
115+
EOF
116+
117+
dpkg-deb --build ${PKG_NAME}
118+
119+
- name: Upload .deb artifact
120+
uses: actions/upload-artifact@v4
121+
with:
122+
name: cc-statusline_${{ steps.version.outputs.version }}_${{ matrix.arch }}.deb
123+
path: "*.deb"
124+
125+
release:
126+
name: Create Release
127+
runs-on: ubuntu-latest
128+
needs: [build, create-deb]
129+
130+
steps:
131+
- uses: actions/checkout@v4
132+
133+
- name: Download all artifacts
134+
uses: actions/download-artifact@v4
135+
with:
136+
path: artifacts
137+
138+
- name: Flatten artifacts
139+
run: |
140+
mkdir -p release
141+
find artifacts -type f \( -name "cc-statusline-*" -o -name "*.deb" -o -name "*.sha256" \) -exec cp {} release/ \;
142+
ls -la release/
143+
144+
- name: Create Release
145+
uses: softprops/action-gh-release@v2
146+
with:
147+
files: release/*
148+
generate_release_notes: true
149+
draft: false
150+
env:
151+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
152+
153+
update-homebrew:
154+
name: Update Homebrew Formula
155+
runs-on: ubuntu-latest
156+
needs: release
157+
158+
steps:
159+
- name: Get version
160+
id: version
161+
run: echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
162+
163+
- name: Download checksums
164+
uses: actions/download-artifact@v4
165+
with:
166+
pattern: cc-statusline-darwin-*
167+
path: checksums
168+
merge-multiple: true
169+
170+
- name: Extract checksums
171+
id: checksums
172+
run: |
173+
ARM64_SHA=$(cat checksums/cc-statusline-darwin-arm64.sha256 | awk '{print $1}')
174+
X86_SHA=$(cat checksums/cc-statusline-darwin-x86_64.sha256 | awk '{print $1}')
175+
echo "arm64_sha=${ARM64_SHA}" >> $GITHUB_OUTPUT
176+
echo "x86_sha=${X86_SHA}" >> $GITHUB_OUTPUT
177+
178+
- name: Update Homebrew tap
179+
uses: peter-evans/repository-dispatch@v3
180+
with:
181+
token: ${{ secrets.HOMEBREW_TAP_TOKEN }}
182+
repository: Demwunz/homebrew-tap
183+
event-type: update-formula
184+
client-payload: |
185+
{
186+
"formula": "cc-statusline",
187+
"version": "${{ steps.version.outputs.version }}",
188+
"arm64_sha": "${{ steps.checksums.outputs.arm64_sha }}",
189+
"x86_sha": "${{ steps.checksums.outputs.x86_sha }}"
190+
}

Formula/cc-statusline.rb

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Homebrew formula for cc-statusline
2+
# To use: brew tap Demwunz/tap && brew install cc-statusline
3+
# Or copy this file to your homebrew-tap repo
4+
5+
class CcStatusline < Formula
6+
desc "Lightweight statusline for Claude Code showing context usage and costs"
7+
homepage "https://github.com/Demwunz/cc-statusline"
8+
version "0.1.0"
9+
license "MIT"
10+
11+
on_macos do
12+
on_arm do
13+
url "https://github.com/Demwunz/cc-statusline/releases/download/v#{version}/cc-statusline-darwin-arm64"
14+
sha256 "PLACEHOLDER_ARM64_SHA256"
15+
16+
def install
17+
bin.install "cc-statusline-darwin-arm64" => "cc-statusline"
18+
end
19+
end
20+
21+
on_intel do
22+
url "https://github.com/Demwunz/cc-statusline/releases/download/v#{version}/cc-statusline-darwin-x86_64"
23+
sha256 "PLACEHOLDER_X86_SHA256"
24+
25+
def install
26+
bin.install "cc-statusline-darwin-x86_64" => "cc-statusline"
27+
end
28+
end
29+
end
30+
31+
on_linux do
32+
on_arm do
33+
url "https://github.com/Demwunz/cc-statusline/releases/download/v#{version}/cc-statusline-linux-arm64"
34+
sha256 "PLACEHOLDER_LINUX_ARM64_SHA256"
35+
36+
def install
37+
bin.install "cc-statusline-linux-arm64" => "cc-statusline"
38+
end
39+
end
40+
41+
on_intel do
42+
url "https://github.com/Demwunz/cc-statusline/releases/download/v#{version}/cc-statusline-linux-x86_64"
43+
sha256 "PLACEHOLDER_LINUX_X86_SHA256"
44+
45+
def install
46+
bin.install "cc-statusline-linux-x86_64" => "cc-statusline"
47+
end
48+
end
49+
end
50+
51+
test do
52+
assert_match version.to_s, shell_output("#{bin}/cc-statusline --version")
53+
end
54+
end

README.md

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,45 @@ Run `cc-statusline --legend` to see this in your terminal.
2323

2424
## Installation
2525

26-
### From source
26+
### Shell script
2727

2828
```bash
29-
git clone https://github.com/Demwunz/cc-statusline.git
30-
cd cc-statusline
31-
cargo install --path .
29+
curl -fsSL https://raw.githubusercontent.com/Demwunz/cc-statusline/main/install.sh | bash
30+
```
31+
32+
### Homebrew
33+
34+
```bash
35+
brew tap Demwunz/tap
36+
brew install cc-statusline
37+
```
38+
39+
### Debian/Ubuntu
40+
41+
Download from [releases](https://github.com/Demwunz/cc-statusline/releases):
42+
43+
```bash
44+
# x86_64
45+
sudo dpkg -i cc-statusline_0.1.0_amd64.deb
46+
47+
# ARM64
48+
sudo dpkg -i cc-statusline_0.1.0_arm64.deb
3249
```
3350

34-
### From crates.io (coming soon)
51+
### Cargo
3552

3653
```bash
3754
cargo install cc-statusline
3855
```
3956

57+
### From source
58+
59+
```bash
60+
git clone https://github.com/Demwunz/cc-statusline.git
61+
cd cc-statusline
62+
cargo install --path .
63+
```
64+
4065
## Setup
4166

4267
Add to your `~/.claude/settings.json`:

homebrew-tap-workflow.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# Add this file to your homebrew-tap repo at:
2+
# https://github.com/Demwunz/homebrew-tap/.github/workflows/update-formula.yml
3+
#
4+
# You'll also need to create a Personal Access Token (PAT) with repo scope
5+
# and add it as a secret named HOMEBREW_TAP_TOKEN in the cc-statusline repo.
6+
7+
name: Update Formula
8+
9+
on:
10+
repository_dispatch:
11+
types: [update-formula]
12+
13+
permissions:
14+
contents: write
15+
16+
jobs:
17+
update:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- name: Update cc-statusline formula
23+
if: github.event.client_payload.formula == 'cc-statusline'
24+
run: |
25+
VERSION="${{ github.event.client_payload.version }}"
26+
ARM64_SHA="${{ github.event.client_payload.arm64_sha }}"
27+
X86_SHA="${{ github.event.client_payload.x86_sha }}"
28+
29+
cat > Formula/cc-statusline.rb << 'FORMULA_EOF'
30+
class CcStatusline < Formula
31+
desc "Lightweight statusline for Claude Code showing context usage and costs"
32+
homepage "https://github.com/Demwunz/cc-statusline"
33+
version "VERSION_PLACEHOLDER"
34+
license "MIT"
35+
36+
on_macos do
37+
on_arm do
38+
url "https://github.com/Demwunz/cc-statusline/releases/download/vVERSION_PLACEHOLDER/cc-statusline-darwin-arm64"
39+
sha256 "ARM64_SHA_PLACEHOLDER"
40+
41+
def install
42+
bin.install "cc-statusline-darwin-arm64" => "cc-statusline"
43+
end
44+
end
45+
46+
on_intel do
47+
url "https://github.com/Demwunz/cc-statusline/releases/download/vVERSION_PLACEHOLDER/cc-statusline-darwin-x86_64"
48+
sha256 "X86_SHA_PLACEHOLDER"
49+
50+
def install
51+
bin.install "cc-statusline-darwin-x86_64" => "cc-statusline"
52+
end
53+
end
54+
end
55+
56+
test do
57+
assert_match version.to_s, shell_output("#{bin}/cc-statusline --version")
58+
end
59+
end
60+
FORMULA_EOF
61+
62+
sed -i "s/VERSION_PLACEHOLDER/${VERSION}/g" Formula/cc-statusline.rb
63+
sed -i "s/ARM64_SHA_PLACEHOLDER/${ARM64_SHA}/g" Formula/cc-statusline.rb
64+
sed -i "s/X86_SHA_PLACEHOLDER/${X86_SHA}/g" Formula/cc-statusline.rb
65+
66+
- name: Commit and push
67+
run: |
68+
git config user.name "github-actions[bot]"
69+
git config user.email "github-actions[bot]@users.noreply.github.com"
70+
git add Formula/
71+
git commit -m "Update cc-statusline to v${{ github.event.client_payload.version }}" || exit 0
72+
git push

0 commit comments

Comments
 (0)