-
Notifications
You must be signed in to change notification settings - Fork 4
143 lines (120 loc) · 3.97 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
name: CI
on:
pull_request:
branches: [main]
push:
branches: [fix-*]
schedule:
# run every 12 hours
# - cron: "20 */12 * * *"
# Every day at 6am
- cron: "0 6 * * *"
# allow run manually
workflow_dispatch:
jobs:
job1:
name: Test Casks
if: github.repository == 'brewforge/homebrew-extras'
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest]
# https://github.com/orgs/Homebrew/discussions/4474#discussioncomment-5781752
# permissions:
# actions: read
# packages: write
# contents: write
# pull-requests: write
steps:
- uses: actions/checkout@v2
with:
repository: brewforge/homebrew-extras
ref: main
path: homebrew-extras
- name: Set up Homebrew
id: set-up-homebrew
uses: Homebrew/actions/setup-homebrew@master
with:
core: true
cask: true
test-bot: false
- name: Add Tap
env:
HOMEBREW_GITHUB_API_TOKEN: ${{ secrets.HOMEBREW_GITHUB_API_TOKEN }}
run: |
brew tap brewforge/extras
brew update
brew install ripgrep sd
- name: Bump outdated casks b-l
# continue-on-error: true
env:
HOMEBREW_GITHUB_API_TOKEN: ${{ secrets.HOMEBREW_GITHUB_API_TOKEN }}
run: |
cd $(brew --prefix)/Homebrew/Library/Taps/brewforge/homebrew-extras/Casks
for cask in [b-l]*.rb; do
cask=$(echo "$cask" | sd "/Casks" "" | sd ".rb" "")
echo "Checking $cask"
# "sed" command not working on github action,
# because of the color code in the output of "brew livecheck --cask" command
check=$(echo $(brew livecheck --cask "$cask") | tr -d ' ' | cut -d':' -f2- | sed 's/\x1b[[0-9;]*m//g')
echo "Check result: $check"
fromV=${check%==>*}
toV=${check#*==>}
echo "Updating $cask from $fromV to $toV"
if [[ "$fromV" != "$toV" ]]; then
brew bump-cask-pr "$cask" --version "$toV" --verbose
fi
done
job2:
name: Test Casks
if: github.repository == 'brewforge/homebrew-extras'
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest]
# https://github.com/orgs/Homebrew/discussions/4474#discussioncomment-5781752
# permissions:
# actions: read
# packages: write
# contents: write
# pull-requests: write
steps:
- uses: actions/checkout@v2
with:
repository: brewforge/homebrew-extras
ref: main
path: homebrew-extras
- name: Set up Homebrew
id: set-up-homebrew
uses: Homebrew/actions/setup-homebrew@master
with:
core: true
cask: true
test-bot: false
- name: Add Tap
env:
HOMEBREW_GITHUB_API_TOKEN: ${{ secrets.HOMEBREW_GITHUB_API_TOKEN }}
run: |
brew tap brewforge/extras
brew update
brew install ripgrep sd
- name: Bump outdated casks m-z
# continue-on-error: true
env:
HOMEBREW_GITHUB_API_TOKEN: ${{ secrets.HOMEBREW_GITHUB_API_TOKEN }}
run: |
cd $(brew --prefix)/Homebrew/Library/Taps/brewforge/homebrew-extras/Casks
for cask in [m-z]*.rb; do
cask=$(echo "$cask" | sd "/Casks" "" | sd ".rb" "")
echo "Checking $cask"
# "sed" command not working on github action,
# because of the color code in the output of "brew livecheck --cask" command
check=$(echo $(brew livecheck --cask "$cask") | tr -d ' ' | cut -d':' -f2- | sed 's/\x1b[[0-9;]*m//g')
echo "Check result: $check"
fromV=${check%==>*}
toV=${check#*==>}
echo "Updating $cask from $fromV to $toV"
if [[ "$fromV" != "$toV" ]]; then
brew bump-cask-pr "$cask" --version "$toV" --verbose
fi
done