Skip to content

Commit f23af5b

Browse files
author
李杰
committed
chore(homebrew): add cask, docs, and release automation
1 parent a75c333 commit f23af5b

4 files changed

Lines changed: 134 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,3 +91,77 @@ jobs:
9191
releaseDraft: false
9292
prerelease: false
9393
args: ${{ matrix.args }}
94+
95+
update-homebrew-cask:
96+
name: Update Homebrew Cask
97+
needs: release
98+
runs-on: ubuntu-latest
99+
if: startsWith(github.ref, 'refs/tags/v')
100+
permissions:
101+
contents: write
102+
pull-requests: write
103+
steps:
104+
# Update the cask on main, not on the tag ref.
105+
- name: Checkout main
106+
uses: actions/checkout@v4
107+
with:
108+
ref: main
109+
110+
- name: Determine version
111+
shell: bash
112+
run: |
113+
VERSION="${GITHUB_REF_NAME#v}"
114+
echo "VERSION=$VERSION" >> "$GITHUB_ENV"
115+
116+
- name: Download universal DMG from GitHub Releases (retry)
117+
shell: bash
118+
run: |
119+
set -euo pipefail
120+
URL="https://github.com/${GITHUB_REPOSITORY}/releases/download/v${VERSION}/Cockpit.Tools_${VERSION}_universal.dmg"
121+
echo "Downloading: $URL"
122+
for i in $(seq 1 30); do
123+
if curl -fL --retry 3 --retry-delay 1 -o cockpit-tools.dmg "$URL"; then
124+
exit 0
125+
fi
126+
echo "Asset not ready yet (attempt $i/30). Sleeping 10s..."
127+
sleep 10
128+
done
129+
echo "Failed to download release asset after retries."
130+
exit 1
131+
132+
- name: Compute sha256
133+
shell: bash
134+
run: |
135+
set -euo pipefail
136+
SHA256="$(sha256sum cockpit-tools.dmg | awk '{print $1}')"
137+
echo "SHA256=$SHA256" >> "$GITHUB_ENV"
138+
139+
- name: Update Cask file
140+
shell: bash
141+
run: |
142+
set -euo pipefail
143+
FILE="Casks/cockpit-tools.rb"
144+
if [ ! -f "$FILE" ]; then
145+
echo "Missing $FILE. Create it first."
146+
exit 1
147+
fi
148+
149+
perl -0777 -i -pe \
150+
's/version \"[^\"]+\"/version \"'"$VERSION"'\"/; s/sha256 \"[0-9a-f]{64}\"/sha256 \"'"$SHA256"'\"/' \
151+
"$FILE"
152+
153+
git diff -- "$FILE"
154+
155+
- name: Create pull request
156+
uses: peter-evans/create-pull-request@v6
157+
with:
158+
commit-message: "chore(homebrew): update cask for v${{ env.VERSION }}"
159+
title: "chore(homebrew): update cask for v${{ env.VERSION }}"
160+
body: |
161+
Auto-generated by the release workflow.
162+
163+
- version: ${{ env.VERSION }}
164+
- sha256 (universal.dmg): ${{ env.SHA256 }}
165+
branch: "automation/update-cask-v${{ env.VERSION }}"
166+
base: main
167+
delete-branch: true

Casks/cockpit-tools.rb

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
cask "cockpit-tools" do
2+
version "0.5.4"
3+
sha256 "8f07029f6d5611dd272ddba7309cd7afb9a3c45842f4bd4728c01f6067d16c62"
4+
5+
url "https://github.com/jlcodes99/cockpit-tools/releases/download/v#{version}/Cockpit.Tools_#{version}_universal.dmg",
6+
verified: "github.com/jlcodes99/cockpit-tools/"
7+
name "Cockpit Tools"
8+
desc "Account manager for AI IDEs (Antigravity and Codex)"
9+
homepage "https://github.com/jlcodes99/cockpit-tools"
10+
11+
auto_updates true
12+
13+
app "Cockpit Tools.app"
14+
15+
zap trash: [
16+
"~/Library/Application Support/com.jlcodes.cockpit-tools",
17+
"~/Library/Caches/com.jlcodes.cockpit-tools",
18+
"~/Library/Preferences/com.jlcodes.cockpit-tools.plist",
19+
"~/Library/Saved Application State/com.jlcodes.cockpit-tools.savedState",
20+
]
21+
22+
caveats <<~EOS
23+
If you encounter the "App is damaged" error, please run:
24+
sudo xattr -rd com.apple.quarantine "/Applications/Cockpit Tools.app"
25+
26+
Or install with the --no-quarantine flag:
27+
brew install --cask --no-quarantine cockpit-tools
28+
EOS
29+
end
30+

README.en.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,21 @@ Go to [GitHub Releases](https://github.com/jlcodes99/cockpit-tools/releases) to
9494
* **Windows**: `.msi` (Recommended) or `.exe`
9595
* **Linux**: `.deb` (Debian/Ubuntu) or `.AppImage` (Universal)
9696

97+
### Option B: Install with Homebrew (macOS)
98+
99+
> Homebrew is required.
100+
101+
```bash
102+
brew tap jlcodes99/cockpit-tools https://github.com/jlcodes99/cockpit-tools
103+
brew install --cask cockpit-tools
104+
```
105+
106+
If you hit the macOS "App is damaged" warning, you can also install with `--no-quarantine`:
107+
108+
```bash
109+
brew install --cask --no-quarantine cockpit-tools
110+
```
111+
97112
### 🛠️ Troubleshooting
98113

99114
#### macOS says "App is damaged and can't be opened"?

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,21 @@ Codex 同样支持多账号多实例并行运行。比如同时打开两个 Code
9191
* **Windows**: `.msi` (推荐) 或 `.exe`
9292
* **Linux**: `.deb` (Debian/Ubuntu) 或 `.AppImage` (通用)
9393

94+
### 选项 B: Homebrew 安装 (macOS)
95+
96+
> 需要先安装 Homebrew。
97+
98+
```bash
99+
brew tap jlcodes99/cockpit-tools https://github.com/jlcodes99/cockpit-tools
100+
brew install --cask cockpit-tools
101+
```
102+
103+
如果遇到 macOS “应用已损坏”或无法打开,也可以使用 `--no-quarantine` 安装:
104+
105+
```bash
106+
brew install --cask --no-quarantine cockpit-tools
107+
```
108+
94109
### 🛠️ 常见问题排查 (Troubleshooting)
95110

96111
#### macOS 提示“应用已损坏,无法打开”?

0 commit comments

Comments
 (0)