Skip to content

Commit f760f38

Browse files
committed
fix: trigger homebrew update on GitHub release
1 parent 540797e commit f760f38

1 file changed

Lines changed: 15 additions & 23 deletions

File tree

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,26 @@
11
name: Update Homebrew Formula
22

33
on:
4-
workflow_run:
5-
workflows: ["Publish to PyPI"]
6-
types: [completed]
4+
release:
5+
types: [published]
76

87
jobs:
98
update-formula:
109
runs-on: ubuntu-latest
11-
if: ${{ github.event.workflow_run.conclusion == 'success' }}
1210
steps:
13-
- name: Get version from PyPI
14-
id: pypi
11+
- name: Get release info
12+
id: release
1513
run: |
16-
# Wait a bit for PyPI to propagate
17-
sleep 10
18-
19-
# Get latest version and SHA256 from PyPI
20-
PYPI_JSON=$(curl -s "https://pypi.org/pypi/aidocs/json")
21-
VERSION=$(echo "$PYPI_JSON" | jq -r '.info.version')
22-
SDIST_URL=$(echo "$PYPI_JSON" | jq -r '.urls[] | select(.packagetype == "sdist") | .url')
23-
SHA256=$(echo "$PYPI_JSON" | jq -r '.urls[] | select(.packagetype == "sdist") | .digests.sha256')
14+
VERSION="${GITHUB_REF_NAME#v}"
15+
URL="https://github.com/${{ github.repository }}/archive/refs/tags/${{ github.ref_name }}.tar.gz"
16+
SHA256=$(curl -sL "$URL" | shasum -a 256 | cut -d' ' -f1)
2417
2518
echo "version=$VERSION" >> $GITHUB_OUTPUT
26-
echo "url=$SDIST_URL" >> $GITHUB_OUTPUT
19+
echo "url=$URL" >> $GITHUB_OUTPUT
2720
echo "sha256=$SHA256" >> $GITHUB_OUTPUT
2821
29-
echo "Found version: $VERSION"
30-
echo "URL: $SDIST_URL"
22+
echo "Version: $VERSION"
23+
echo "URL: $URL"
3124
echo "SHA256: $SHA256"
3225
3326
- name: Checkout homebrew-aidocs
@@ -39,22 +32,21 @@ jobs:
3932

4033
- name: Update formula
4134
run: |
42-
cd homebrew-aidocs
43-
cat > Formula/aidocs.rb << EOF
35+
cat > homebrew-aidocs/Formula/aidocs.rb << EOF
4436
class Aidocs < Formula
4537
include Language::Python::Virtualenv
4638
4739
desc "AI-powered documentation generator CLI for Claude Code"
4840
homepage "https://github.com/binarcode/aidocs-cli"
49-
url "${{ steps.pypi.outputs.url }}"
50-
sha256 "${{ steps.pypi.outputs.sha256 }}"
41+
url "${{ steps.release.outputs.url }}"
42+
sha256 "${{ steps.release.outputs.sha256 }}"
5143
license "MIT"
5244
5345
depends_on "python@3.11"
5446
5547
def install
5648
venv = virtualenv_create(libexec, "python3.11")
57-
venv.pip_install "aidocs==${{ steps.pypi.outputs.version }}"
49+
venv.pip_install "aidocs==${{ steps.release.outputs.version }}"
5850
bin.install_symlink libexec/"bin/aidocs"
5951
end
6052
@@ -70,5 +62,5 @@ jobs:
7062
git config user.name "GitHub Actions"
7163
git config user.email "actions@github.com"
7264
git add Formula/aidocs.rb
73-
git diff --staged --quiet || git commit -m "Update aidocs to ${{ steps.pypi.outputs.version }}"
65+
git diff --staged --quiet || git commit -m "Update aidocs to ${{ steps.release.outputs.version }}"
7466
git push

0 commit comments

Comments
 (0)