@@ -61,122 +61,5 @@ jobs:
6161 --title "${{ steps.release.outputs.tag }}" \
6262 --generate-notes
6363
64- update-homebrew :
65- needs : release
66- if : needs.release.outputs.released == 'true'
67- runs-on : ubuntu-latest
68- steps :
69- - uses : actions/checkout@v4
70- with :
71- persist-credentials : false
72-
73- - name : Get job context
74- id : context
75- uses : qoomon/actions--context@v4
76-
77- - name : Authenticate as GitHub App
78- id : auth
79- uses : ./.github/actions/github-app-auth
80- with :
81- app-id : ${{ secrets.AUTOMATION_GITHUB_APP_ID }}
82- private-key : ${{ secrets.AUTOMATION_GITHUB_APP_PRIVATE_KEY }}
83-
84- - name : Get release info
85- id : release
86- run : |
87- VERSION="${{ needs.release.outputs.version }}"
88- TAG="${{ needs.release.outputs.tag }}"
89- echo "version=$VERSION" >> "$GITHUB_OUTPUT"
90- echo "tag=$TAG" >> "$GITHUB_OUTPUT"
91-
92- # Download asset using gh CLI (more reliable than curl for fresh releases)
93- # Retry up to 5 times with 10s delay to handle CDN propagation
94- for i in {1..5}; do
95- echo "Attempt $i: Downloading release asset..."
96- if gh release download "$TAG" --pattern 'git-wt' --output /tmp/git-wt --clobber; then
97- # Verify it's actually the script (not an error page)
98- if head -1 /tmp/git-wt | grep -q '^#!/'; then
99- SHA256=$(shasum -a 256 /tmp/git-wt | cut -d' ' -f1)
100- echo "sha256=$SHA256" >> "$GITHUB_OUTPUT"
101- echo "Successfully got SHA256: $SHA256"
102- exit 0
103- else
104- echo "Downloaded file doesn't look like a script, retrying..."
105- fi
106- fi
107- echo "Download failed or invalid, waiting 10s before retry..."
108- sleep 10
109- done
110- echo "Failed to download release asset after 5 attempts"
111- exit 1
112-
113- - name : Clone homebrew-devsetup
114- run : |
115- gh repo clone nsheaps/homebrew-devsetup homebrew-devsetup
116-
117- - name : Update formula
118- run : |
119- cd homebrew-devsetup
120- cat > Formula/git-wt.rb << FORMULA_EOF
121- # typed: false
122- # frozen_string_literal: true
123-
124- class GitWt < Formula
125- desc "Interactive TUI for git worktree management"
126- homepage "https://github.com/nsheaps/git-wt"
127- url "https://github.com/nsheaps/git-wt/releases/download/${{ steps.release.outputs.tag }}/git-wt"
128- sha256 "${{ steps.release.outputs.sha256 }}"
129- version "${{ steps.release.outputs.version }}"
130- license "MIT"
131-
132- head do
133- url "https://github.com/nsheaps/git-wt.git", branch: "main"
134- end
135-
136- depends_on "gum"
137-
138- def install
139- if build.head?
140- bin.install "bin/git-wt"
141- else
142- bin.install "git-wt"
143- end
144- end
145-
146- test do
147- assert_match "git-wt", shell_output("#{bin}/git-wt --help")
148- end
149- end
150- FORMULA_EOF
151- # Remove leading whitespace from heredoc
152- sed -i 's/^ //' Formula/git-wt.rb
153-
154- - name : Create PR to update formula with auto-merge
155- env :
156- RELEASE_URL : https://github.com/${{ github.repository }}/releases/tag/${{ steps.release.outputs.tag }}
157- JOB_URL : ${{ env.GITHUB_JOB_URL }}
158- VERSION : ${{ steps.release.outputs.version }}
159- TAG : ${{ steps.release.outputs.tag }}
160- run : |
161- cd homebrew-devsetup
162- BRANCH="bump-git-wt-${VERSION}"
163- git checkout -b "$BRANCH"
164- git add Formula/git-wt.rb
165- git commit -m "chore: update git-wt to ${VERSION}"
166- git push -u origin "$BRANCH"
167-
168- # Create PR body file
169- cat > /tmp/pr-body.md << 'BODY_EOF'
170- Automated formula update from git-wt release
171- BODY_EOF
172- echo "" >> /tmp/pr-body.md
173- echo "**Release:** ${RELEASE_URL}" >> /tmp/pr-body.md
174- echo "**Workflow:** ${JOB_URL}" >> /tmp/pr-body.md
175-
176- PR_URL=$(gh pr create \
177- --title "chore: update git-wt to ${VERSION}" \
178- --body-file /tmp/pr-body.md \
179- --base main)
180- # Enable auto-merge with squash
181- gh pr merge "$PR_URL" --auto --squash
64+ # NOTE: Homebrew formula updates are handled by Renovate in nsheaps/homebrew-devsetup
18265
0 commit comments