Skip to content

Commit 4bcbf1e

Browse files
committed
ci: Add Homebrew update
1 parent f6fff82 commit 4bcbf1e

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

.github/workflows/brew-update.yaml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Update Homebrew Formulae
2+
on:
3+
release:
4+
types: [released]
5+
6+
workflow_dispatch:
7+
push:
8+
branches: [main]
9+
paths:
10+
- .github/workflows/brew-update.yaml
11+
12+
jobs:
13+
Update:
14+
runs-on: macos-latest
15+
steps:
16+
- name: Tap
17+
run: |
18+
brew tap ${{ github.repository_owner }}/yamlscript
19+
brew install ys
20+
21+
- name: Livecheck
22+
id: livecheck
23+
env:
24+
HOMEBREW_GITHUB_API_TOKEN: ${{ github.token }}
25+
run: |
26+
brew livecheck --newer-only --quiet --json ys |
27+
jq --raw-output '"version=\(.[].version.latest)"' >> $GITHUB_OUTPUT
28+
29+
- name: Checkout
30+
if: steps.livecheck.outputs.version != ''
31+
uses: actions/checkout@v4
32+
33+
- name: Configure Git
34+
if: steps.livecheck.outputs.version != ''
35+
run: |
36+
git config --global user.name ${{ github.repository_owner }}
37+
git config --global user.email ${{ github.event.pusher.email }}
38+
39+
- name: Bump Version
40+
if: steps.livecheck.outputs.version != ''
41+
env:
42+
version: ${{ steps.livecheck.outputs.version }}
43+
GH_TOKEN: ${{ secrets.ACCESS_TOKEN }}
44+
run: |
45+
util/brew-update $version
46+
cd homebrew-yamlscript
47+
gh auth setup-git
48+
git add --all
49+
git commit --message "Update $version"
50+
git push

0 commit comments

Comments
 (0)