Skip to content

Commit e239280

Browse files
committed
.github update homebrew
1 parent a8a3635 commit e239280

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Update Homebrew Formula
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
update-homebrew:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout main repo
13+
uses: actions/checkout@v4
14+
with:
15+
repository: Matars/gitfetch
16+
path: gitfetch
17+
18+
- name: Get version from pyproject.toml
19+
id: get_version
20+
run: |
21+
VERSION=$(grep '^version =' gitfetch/pyproject.toml | sed 's/version = "\(.*\)"/\1/')
22+
echo "version=$VERSION" >> $GITHUB_OUTPUT
23+
24+
- name: Download release tarball
25+
run: |
26+
curl -L -o release.tar.gz https://github.com/Matars/gitfetch/archive/refs/tags/v${{ steps.get_version.outputs.version }}.tar.gz
27+
28+
- name: Calculate SHA256
29+
id: sha256
30+
run: |
31+
SHA256=$(shasum -a 256 release.tar.gz | cut -d' ' -f1)
32+
echo "sha256=$SHA256" >> $GITHUB_OUTPUT
33+
34+
- name: Checkout tap repo
35+
uses: actions/checkout@v4
36+
with:
37+
repository: Matars/homebrew-gitfetch
38+
token: ${{ secrets.HOMEBREW_TAP_TOKEN }}
39+
path: homebrew-tap
40+
41+
- name: Update formula
42+
run: |
43+
sed -i 's|url "https://github.com/Matars/gitfetch/archive/refs/tags/v.*"|url "https://github.com/Matars/gitfetch/archive/refs/tags/v${{ steps.get_version.outputs.version }}"|' homebrew-tap/Formula/gitfetch.rb
44+
sed -i 's|version ".*"|version "${{ steps.get_version.outputs.version }}"|' homebrew-tap/Formula/gitfetch.rb
45+
sed -i 's|sha256 ".*"|sha256 "${{ steps.sha256.outputs.sha256 }}"|' homebrew-tap/Formula/gitfetch.rb
46+
47+
- name: Commit and push
48+
run: |
49+
cd homebrew-tap
50+
git config user.name "GitHub Actions"
51+
git config user.email "[email protected]"
52+
git add Formula/gitfetch.rb
53+
git commit -m "Update gitfetch to v${{ steps.get_version.outputs.version }}"
54+
git push

0 commit comments

Comments
 (0)