Skip to content

Commit 8e78513

Browse files
committed
ci: Add Homebrew update
1 parent f6fff82 commit 8e78513

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

.github/workflows/brew-update.yaml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
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: Checkout
17+
uses: actions/checkout@v4
18+
19+
- name: Tap
20+
run: |
21+
brew tap ${{ github.repository_owner }}/yamlscript
22+
brew install ys
23+
24+
- name: Livecheck
25+
id: livecheck
26+
env:
27+
HOMEBREW_GITHUB_API_TOKEN: ${{ github.token }}
28+
run: |
29+
brew livecheck --newer-only --quiet --json ys |
30+
jq --raw-output '"version=\(.[].version.latest)"' >> $GITHUB_OUTPUT
31+
32+
- name: Configure Git
33+
if: steps.livecheck.outputs.version != ''
34+
run: |
35+
git config --global user.name ${{ github.repository_owner }}
36+
git config --global user.email ${{ github.event.pusher.email }}
37+
38+
- name: Bump Version
39+
if: steps.livecheck.outputs.version != ''
40+
env:
41+
version: ${{ steps.livecheck.outputs.version }}
42+
GH_TOKEN: ${{ secrets.ACCESS_TOKEN }}
43+
run: |
44+
util/brew-update $version
45+
cd homebrew-yamlscript
46+
gh auth setup-git
47+
git add --all
48+
git commit --message "Update $version"
49+
git push

0 commit comments

Comments
 (0)