Skip to content

Commit fe56376

Browse files
Gregg CochranCopilot
andcommitted
Use bump-homebrew-formula-action to sync tap on release
Replaces the in-repo formula update with a push to the dedicated DUBSOpenHub/homebrew-copilot-cli-agent-pulse tap. Requires a HOMEBREW_TAP_TOKEN PAT secret with contents:write on the tap repo. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 937d899 commit fe56376

1 file changed

Lines changed: 26 additions & 59 deletions

File tree

.github/workflows/release.yml

Lines changed: 26 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,37 @@
1-
name: Release & Update Homebrew Formula
1+
name: Bump Homebrew Formula
22

33
on:
44
release:
55
types: [published]
6-
7-
permissions:
8-
contents: write
6+
workflow_dispatch:
7+
inputs:
8+
tag:
9+
description: "Release tag to bump (e.g. v2.3.2)"
10+
required: true
911

1012
jobs:
11-
update-formula:
13+
bump:
1214
runs-on: ubuntu-latest
1315
steps:
14-
- uses: actions/checkout@v4
15-
with:
16-
ref: main
17-
18-
- name: Get release tag
16+
- name: Resolve tag
1917
id: tag
20-
run: echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
21-
22-
- name: Download source tarball and compute SHA256
23-
id: sha
24-
run: |
25-
TARBALL_URL="https://github.com/${{ github.repository }}/archive/refs/tags/${GITHUB_REF_NAME}.tar.gz"
26-
SHA256=$(curl -sL "$TARBALL_URL" | shasum -a 256 | awk '{print $1}')
27-
echo "sha256=$SHA256" >> "$GITHUB_OUTPUT"
28-
echo "url=$TARBALL_URL" >> "$GITHUB_OUTPUT"
29-
30-
- name: Update formula version and SHA256
31-
run: |
32-
python3 - <<'PYEOF'
33-
import re
34-
35-
with open("Formula/agent-pulse.rb") as f:
36-
content = f.read()
37-
38-
# Update the source url
39-
content = re.sub(
40-
r'( url )"https://github\.com/.*/archive/refs/tags/.*\.tar\.gz"',
41-
rf'\1"${{ steps.sha.outputs.url }}"',
42-
content,
43-
count=1,
44-
)
45-
46-
# Update the source sha256 (the one right after the url line, before license)
47-
content = re.sub(
48-
r'( url "https://github\.com/.*\.tar\.gz"\n )sha256 ".*?"',
49-
rf'\g<1>sha256 "${{ steps.sha.outputs.sha256 }}"',
50-
content,
51-
count=1,
52-
)
53-
54-
with open("Formula/agent-pulse.rb", "w") as f:
55-
f.write(content)
56-
PYEOF
57-
58-
- name: Verify formula syntax
59-
run: ruby -c Formula/agent-pulse.rb
60-
61-
- name: Commit and push updated formula
6218
run: |
63-
git config user.name "github-actions[bot]"
64-
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
65-
git add Formula/agent-pulse.rb
66-
git diff --cached --quiet && echo "No changes to commit" && exit 0
67-
git commit -m "Update Homebrew formula for ${GITHUB_REF_NAME}
19+
TAG="${{ github.event.release.tag_name || inputs.tag }}"
20+
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
6821
69-
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>"
70-
git push origin main
22+
- uses: mislav/bump-homebrew-formula-action@v3
23+
with:
24+
formula-name: agent-pulse
25+
formula-path: Formula/agent-pulse.rb
26+
homebrew-tap: DUBSOpenHub/homebrew-copilot-cli-agent-pulse
27+
base-branch: main
28+
tag-name: ${{ steps.tag.outputs.tag }}
29+
download-url: https://github.com/${{ github.repository }}/archive/refs/tags/${{ steps.tag.outputs.tag }}.tar.gz
30+
commit-message: |
31+
agent-pulse {{version}}
32+
33+
Created by https://github.com/mislav/bump-homebrew-formula-action
34+
35+
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
36+
env:
37+
COMMITTER_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }}

0 commit comments

Comments
 (0)