Skip to content

Commit 27fbf0c

Browse files
committed
feat: simplify Homebrew formula update process with action
1 parent cd49f30 commit 27fbf0c

1 file changed

Lines changed: 17 additions & 46 deletions

File tree

.github/workflows/release.yml

Lines changed: 17 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -80,49 +80,20 @@ jobs:
8080
- name: Checkout code
8181
uses: actions/checkout@v4
8282

83-
- name: Get version from tag
84-
id: get_version
85-
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
86-
87-
- name: Download release assets
88-
run: |
89-
VERSION=${{ steps.get_version.outputs.VERSION }}
90-
91-
# Download both archives
92-
curl -L -o tide-aarch64-apple-darwin.tar.gz \
93-
"https://github.com/${{ github.repository }}/releases/download/v${VERSION}/tide-aarch64-apple-darwin.tar.gz"
94-
curl -L -o tide-x86_64-apple-darwin.tar.gz \
95-
"https://github.com/${{ github.repository }}/releases/download/v${VERSION}/tide-x86_64-apple-darwin.tar.gz"
96-
97-
# Calculate SHA256
98-
AARCH64_SHA=$(shasum -a 256 tide-aarch64-apple-darwin.tar.gz | awk '{print $1}')
99-
X86_64_SHA=$(shasum -a 256 tide-x86_64-apple-darwin.tar.gz | awk '{print $1}')
100-
101-
echo "AARCH64_SHA=${AARCH64_SHA}" >> $GITHUB_ENV
102-
echo "X86_64_SHA=${X86_64_SHA}" >> $GITHUB_ENV
103-
104-
- name: Clone homebrew tap
105-
run: |
106-
git clone https://github.com/BreathCodeFlow/homebrew-tap.git homebrew-tap
107-
108-
- name: Update formula
109-
run: |
110-
VERSION=${{ steps.get_version.outputs.VERSION }}
111-
112-
# Update version
113-
sed -i '' "s/version \".*\"/version \"${VERSION}\"/" homebrew-tap/Formula/tide.rb
114-
115-
# Update ARM64 SHA256
116-
sed -i '' "$(printf '10c\\\n sha256 "%s"' "$AARCH64_SHA")" homebrew-tap/Formula/tide.rb
117-
118-
# Update x86_64 SHA256
119-
sed -i '' "$(printf '13c\\\n sha256 "%s"' "$X86_64_SHA")" homebrew-tap/Formula/tide.rb
120-
121-
- name: Commit and push
122-
run: |
123-
cd homebrew-tap
124-
git config user.name "github-actions[bot]"
125-
git config user.email "github-actions[bot]@users.noreply.github.com"
126-
git add Formula/tide.rb
127-
git commit -m "chore: update tide formula to v${{ steps.get_version.outputs.VERSION }}"
128-
git push https://x-access-token:${{ secrets.HOMEBREW_TAP_TOKEN }}@github.com/BreathCodeFlow/homebrew-tap.git main
83+
- name: Update Homebrew formula
84+
uses: dawidd6/action-homebrew-bump-formula@v4
85+
with:
86+
# Required, custom personal GitHub access token with only the 'public_repo' scope enabled
87+
token: ${{secrets.GITHUB_TOKEN}}
88+
# Optional, will commit with this user name
89+
user_name: BreathCodeFlow
90+
# Optional, will commit with this user email
91+
user_email: markus.sommer@fullhaus.de
92+
# Bump all outdated formulae in this tap
93+
tap: BreathCodeFlow/homebrew-tap
94+
# Bump only these formulae if outdated
95+
formula: tide
96+
# Optional, if don't want to check for already open PRs
97+
force: true # true
98+
# Need to set this input if want to use `brew livecheck`
99+
livecheck: true

0 commit comments

Comments
 (0)