Skip to content

Commit 727ec32

Browse files
committed
feat: homebrew
1 parent b63e502 commit 727ec32

File tree

1 file changed

+75
-0
lines changed

1 file changed

+75
-0
lines changed

.github/workflows/homebrew.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: Update Homebrew Formula
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
workflow_dispatch:
8+
inputs:
9+
version:
10+
description: "Version to test (without the v prefix)"
11+
required: true
12+
default: "0.8.0"
13+
14+
permissions:
15+
contents: read
16+
17+
jobs:
18+
update-formula:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout main repository
22+
uses: actions/checkout@v4
23+
24+
- name: Get release version
25+
id: get_version
26+
run: |
27+
if [ -n "${{ github.event.inputs.version }}" ]; then
28+
VERSION=${{ github.event.inputs.version }}
29+
else
30+
VERSION=${GITHUB_REF#refs/tags/v}
31+
fi
32+
echo "version=$VERSION" >> $GITHUB_OUTPUT
33+
34+
- name: Download ARM binary SHA
35+
id: arm
36+
run: |
37+
VERSION=${{ github.event.inputs.version || github.ref_name }}
38+
curl -L -o arm.sha256 \
39+
https://github.com/joncrangle/sketchybar-system-stats/releases/download/${VERSION}/stats_provider-${VERSION}-aarch64-apple-darwin.tar.gz.sha256
40+
ARM_SHA256=$(cat arm.sha256)
41+
echo "arm_sha256=$ARM_SHA256" >> $GITHUB_OUTPUT
42+
43+
- name: Download Intel binary SHA
44+
id: intel
45+
run: |
46+
VERSION=${{ github.event.inputs.version || github.ref_name }}
47+
curl -L -o intel.sha256 \
48+
https://github.com/joncrangle/sketchybar-system-stats/releases/download/${VERSION}/stats_provider-${VERSION}-x86_64-apple-darwin.tar.gz.sha256
49+
INTEL_SHA256=$(cat intel.sha256)
50+
echo "intel_sha256=$INTEL_SHA256" >> $GITHUB_OUTPUT
51+
52+
- name: Clone Homebrew tap
53+
uses: actions/checkout@v4
54+
with:
55+
repository: joncrangle/homebrew-tap
56+
token: ${{ secrets.HOMEBREW_TAP_TOKEN }}
57+
path: tap
58+
59+
- name: Update formula
60+
run: |
61+
FORMULA=tap/Formula/sketchybar-system-stats.rb
62+
VERSION=${{ steps.get_version.outputs.version }}
63+
sed -i '' "s|stats_provider-[0-9.]\+-aarch64-apple-darwin.tar.gz|stats_provider-${VERSION}-aarch64-apple-darwin.tar.gz|g" $FORMULA
64+
sed -i '' "s|stats_provider-[0-9.]\+-x86_64-apple-darwin.tar.gz|stats_provider-${VERSION}-x86_64-apple-darwin.tar.gz|g" $FORMULA
65+
sed -i '' "s|sha256 \".*\"|sha256 \"${ARM_SHA256}\"|" $FORMULA
66+
sed -i '' "0,/sha256 \".*\"/{s//sha256 \"${INTEL_SHA256}\"/}" $FORMULA
67+
68+
- name: Commit and push
69+
run: |
70+
cd tap
71+
git config user.name "github-actions[bot]"
72+
git config user.email "github-actions[bot]@users.noreply.github.com"
73+
git add Formula/sketchybar-system-stats.rb
74+
git commit -m "Update sketchybar-system-stats to v${{ steps.get_version.outputs.version }}"
75+
git push

0 commit comments

Comments
 (0)