-
-
Notifications
You must be signed in to change notification settings - Fork 21
44 lines (39 loc) · 1.3 KB
/
homebrew.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
name: homebrew-update
on:
workflow_dispatch:
branches: [ main ]
workflow_run:
workflows: ["release"]
types:
- completed
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout OneDrive Uploader
uses: actions/checkout@v4
with:
path: ./onedrive-uploader
- name: Set version env
run: echo "CI_VERSION=$(cat ./onedrive-uploader/VERSION | awk NF)" >> $GITHUB_ENV
- name: Checkout Homebrew Taps
uses: actions/checkout@v4
with:
repository: virtualzone/homebrew-tap
token: ${{ secrets.PAT }}
path: ./taps
- name: Update Formula
run: |
URL="https://github.com/virtualzone/onedrive-uploader/archive/refs/tags/${{ env.CI_VERSION }}.tar.gz"
CHECKSUM=`curl -sL "${URL}" | sha256sum | awk '{ print $1 }'`
cat ./onedrive-uploader/homebrew/onedrive-uploader.rb | sed -e "s/{{version}}/${{ env.CI_VERSION }}/" -e "s/{{sha256sum}}/${CHECKSUM}/" > ./taps/onedrive-uploader.rb
- name: Push Homebrew Taps
run: |
cd ./taps
if [ -n "$(git status --porcelain)" ]; then
git add .
git config user.name github-actions
git config user.email [email protected]
git commit -am "Update to ${{ env.CI_VERSION }}"
git push
fi