Skip to content

Commit 335a95b

Browse files
committed
ci: update homebrew tap on release
1 parent d8c8778 commit 335a95b

1 file changed

Lines changed: 59 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,62 @@ jobs:
4444
args: release --clean --config /tmp/.goreleaser.yaml
4545
env:
4646
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47+
48+
update-homebrew-tap:
49+
runs-on: ubuntu-latest
50+
needs: goreleaser
51+
steps:
52+
- name: Resolve release tag
53+
run: |
54+
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
55+
echo "RELEASE_TAG=${{ inputs.tag }}" >> "$GITHUB_ENV"
56+
else
57+
echo "RELEASE_TAG=${{ github.ref_name }}" >> "$GITHUB_ENV"
58+
fi
59+
60+
- name: Dispatch tap formula update
61+
env:
62+
GH_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }}
63+
run: |
64+
if [ -z "$GH_TOKEN" ]; then
65+
echo "::error::Set HOMEBREW_TAP_TOKEN with workflow access to steipete/homebrew-tap"
66+
exit 1
67+
fi
68+
69+
request_id="discrawl-${RELEASE_TAG}-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}"
70+
expected_title="Update discrawl for ${RELEASE_TAG} (${request_id})"
71+
72+
gh workflow run update-formula.yml \
73+
--repo steipete/homebrew-tap \
74+
--ref main \
75+
-f formula=discrawl \
76+
-f tag="$RELEASE_TAG" \
77+
-f repository=openclaw/discrawl \
78+
-f artifact_template="{formula}_{version}_{target}.tar.gz" \
79+
-f request_id="$request_id"
80+
81+
run_id=""
82+
for _ in {1..30}; do
83+
run_id=$(gh run list \
84+
--repo steipete/homebrew-tap \
85+
--workflow update-formula.yml \
86+
--branch main \
87+
--event workflow_dispatch \
88+
--limit 20 \
89+
--json databaseId,displayTitle \
90+
--jq ".[] | select(.displayTitle == \"$expected_title\") | .databaseId" | head -n1)
91+
if [ -n "$run_id" ]; then
92+
break
93+
fi
94+
sleep 5
95+
done
96+
97+
if [ -z "$run_id" ]; then
98+
echo "::error::Could not find tap workflow run with title: $expected_title"
99+
exit 1
100+
fi
101+
102+
gh run watch "$run_id" \
103+
--repo steipete/homebrew-tap \
104+
--exit-status \
105+
--interval 10

0 commit comments

Comments
 (0)