forked from awsl-project/maxx
-
Notifications
You must be signed in to change notification settings - Fork 0
68 lines (58 loc) · 2 KB
/
update-homebrew.yml
File metadata and controls
68 lines (58 loc) · 2 KB
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
name: Update Homebrew Cask
on:
workflow_dispatch:
inputs:
tag:
description: "版本号 (例如: v1.0.0)"
required: true
type: string
workflow_call:
inputs:
tag:
required: true
type: string
secrets:
HOMEBREW_TAP_TOKEN:
required: true
jobs:
update-homebrew:
runs-on: ubuntu-latest
steps:
- name: Download macOS checksums
run: |
VERSION="${{ inputs.tag }}"
BASE_URL="https://github.com/${{ github.repository }}/releases/download/${VERSION}"
curl -sL "${BASE_URL}/maxx-macOS-arm64.dmg.sha256" -o arm64.sha256
curl -sL "${BASE_URL}/maxx-macOS-amd64.dmg.sha256" -o amd64.sha256
- name: Update Homebrew Cask
env:
GH_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }}
run: |
VERSION="${{ inputs.tag }}"
VERSION_NUM="${VERSION#v}"
ARM64_SHA=$(cat arm64.sha256)
AMD64_SHA=$(cat amd64.sha256)
cat > maxx.rb << CASK_EOF
cask "maxx" do
version "${VERSION_NUM}"
name "maxx"
desc "maxx"
if Hardware::CPU.intel?
url "https://github.com/awsl-project/maxx/releases/download/v#{version}/maxx-macOS-amd64.dmg"
sha256 "${AMD64_SHA}"
else
url "https://github.com/awsl-project/maxx/releases/download/v#{version}/maxx-macOS-arm64.dmg"
sha256 "${ARM64_SHA}"
end
homepage "https://github.com/awsl-project/maxx"
app "maxx.app"
end
CASK_EOF
git clone https://git:${GH_TOKEN}@github.com/awsl-project/homebrew-awsl.git
cp maxx.rb homebrew-awsl/Casks/maxx.rb
cd homebrew-awsl
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add Casks/maxx.rb
git commit -m "Update maxx to ${VERSION}" || echo "No changes to commit"
git push