forked from wxtsky/CodeIsland
-
Notifications
You must be signed in to change notification settings - Fork 1
87 lines (75 loc) · 3.07 KB
/
Copy pathrelease.yml
File metadata and controls
87 lines (75 loc) · 3.07 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
name: Release
on:
release:
types: [published]
permissions:
contents: read
jobs:
update-homebrew:
runs-on: ubuntu-latest
steps:
- name: Extract version from tag
run: echo "VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_ENV
- name: Check Homebrew tap token
id: homebrew-token
env:
HOMEBREW_TAP_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }}
run: |
if [ "$GITHUB_REPOSITORY" != "wxtsky/CodeIsland" ]; then
echo "available=false" >> "$GITHUB_OUTPUT"
echo "Skipping Homebrew tap update for fork repository $GITHUB_REPOSITORY."
elif [ -n "$HOMEBREW_TAP_TOKEN" ]; then
echo "available=true" >> "$GITHUB_OUTPUT"
else
echo "available=false" >> "$GITHUB_OUTPUT"
echo "HOMEBREW_TAP_TOKEN is not configured; skipping Homebrew tap update."
fi
- name: Download DMG from release
if: steps.homebrew-token.outputs.available == 'true'
run: |
curl -L \
"https://github.com/${GITHUB_REPOSITORY}/releases/download/v${VERSION}/CodeIsland.dmg" \
-o CodeIsland.dmg
- name: Compute SHA256
if: steps.homebrew-token.outputs.available == 'true'
run: echo "SHA256=$(sha256sum CodeIsland.dmg | awk '{print $1}')" >> $GITHUB_ENV
- name: Clone homebrew-tap
if: steps.homebrew-token.outputs.available == 'true'
env:
HOMEBREW_TAP_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }}
run: |
git clone "https://x-access-token:${HOMEBREW_TAP_TOKEN}@github.com/wxtsky/homebrew-tap.git" homebrew-tap
- name: Update Cask formula
if: steps.homebrew-token.outputs.available == 'true'
run: |
mkdir -p homebrew-tap/Casks
cat > homebrew-tap/Casks/codeisland.rb <<'CASK_EOF'
cask "codeisland" do
version "VERSION_PLACEHOLDER"
sha256 "SHA256_PLACEHOLDER"
url "https://github.com/wxtsky/CodeIsland/releases/download/v#{version}/CodeIsland.dmg"
name "CodeIsland"
desc "Menu bar companion for Claude Code, Codex, Gemini CLI and more"
homepage "https://github.com/wxtsky/CodeIsland"
app "CodeIsland.app"
zap trash: [
"~/.codeisland",
]
end
CASK_EOF
sed -i "s/VERSION_PLACEHOLDER/${VERSION}/" homebrew-tap/Casks/codeisland.rb
sed -i "s/SHA256_PLACEHOLDER/${SHA256}/" homebrew-tap/Casks/codeisland.rb
sed -i 's/^ //' homebrew-tap/Casks/codeisland.rb
- name: Commit and push to homebrew-tap
if: steps.homebrew-token.outputs.available == 'true'
run: |
cd homebrew-tap
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add Casks/codeisland.rb
if git diff --cached --quiet; then
echo "Homebrew cask is already up to date."
exit 0
fi
git commit -m "Update codeisland to ${VERSION}"
git push