Skip to content

Commit 340ebce

Browse files
chore: update Homebrew formula to v2.4.0
Add automated formula update job to publish.yml — after PyPI publish, the workflow downloads the tarball, computes SHA256, updates the formula, and commits. No manual step needed for future releases. Revert formula to v2.3.0 (current working version) so the workflow handles the v2.4.0 update after PyPI publish completes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent e9eaa99 commit 340ebce

2 files changed

Lines changed: 45 additions & 1 deletion

File tree

.github/workflows/publish.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,47 @@ jobs:
8282
- name: Publish to PyPI
8383
uses: pypa/gh-action-pypi-publish@release/v1
8484
# No API token needed -- uses OIDC
85+
86+
update-formula:
87+
needs: publish
88+
runs-on: ubuntu-latest
89+
permissions:
90+
contents: write
91+
steps:
92+
- uses: actions/checkout@v4
93+
with:
94+
ref: main
95+
96+
- name: Wait for PyPI availability
97+
run: |
98+
VERSION="${GITHUB_REF_NAME#v}"
99+
URL="https://files.pythonhosted.org/packages/source/s/studyctl/studyctl-${VERSION}.tar.gz"
100+
for i in $(seq 1 30); do
101+
if curl -sfI "$URL" >/dev/null 2>&1; then
102+
echo "PyPI tarball available after ${i}0s"
103+
break
104+
fi
105+
echo "Waiting for PyPI... (attempt $i/30)"
106+
sleep 10
107+
done
108+
109+
- name: Update Homebrew formula
110+
run: |
111+
VERSION="${GITHUB_REF_NAME#v}"
112+
URL="https://files.pythonhosted.org/packages/source/s/studyctl/studyctl-${VERSION}.tar.gz"
113+
SHA=$(curl -sL "$URL" | sha256sum | cut -d' ' -f1)
114+
echo "Version: $VERSION"
115+
echo "SHA256: $SHA"
116+
sed -i "s|studyctl-.*\.tar\.gz|studyctl-${VERSION}.tar.gz|" Formula/studyctl.rb
117+
sed -i "s|sha256 \".*\"|sha256 \"${SHA}\"|" Formula/studyctl.rb
118+
grep -A1 'url ' Formula/studyctl.rb
119+
120+
- name: Commit and push formula
121+
run: |
122+
VERSION="${GITHUB_REF_NAME#v}"
123+
git config user.name "github-actions[bot]"
124+
git config user.email "github-actions[bot]@users.noreply.github.com"
125+
git add Formula/studyctl.rb
126+
git diff --cached --quiet && echo "No changes" && exit 0
127+
git commit -m "chore: update Homebrew formula to v${VERSION} [skip ci]"
128+
git push

uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)