-
-
Notifications
You must be signed in to change notification settings - Fork 25
136 lines (118 loc) · 4.18 KB
/
Copy pathupdate-formula.yml
File metadata and controls
136 lines (118 loc) · 4.18 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
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
name: Update Formula
run-name: Update ${{ inputs.formula }} for ${{ inputs.tag }}${{ inputs.request_id && format(' ({0})', inputs.request_id) || '' }}
on:
workflow_dispatch:
inputs:
formula:
description: "Formula name (e.g., gitcrawl)"
required: true
type: string
tag:
description: "Release tag to update formula for"
required: true
type: string
repository:
description: "Source repository (e.g., openclaw/gitcrawl)"
required: true
type: string
description:
description: "Formula description used when creating a missing formula"
required: false
type: string
macos_artifact:
description: "macOS artifact name (defaults to <formula>-macos-universal.tar.gz)"
required: false
type: string
linux_url:
description: "Linux archive URL (defaults to the GitHub tag archive)"
required: false
type: string
artifact_template:
description: "Multi-arch asset template, e.g. {formula}_{version}_{target}.tar.gz"
required: false
type: string
artifact_url:
description: "Direct artifact/source URL template for top-level formulae"
required: false
type: string
target_aliases:
description: "Comma-separated canonical=artifact-target aliases for custom asset names"
required: false
type: string
cask:
description: "Optional cask name to update with the same release"
required: false
type: string
cask_artifact:
description: "Release asset name for the optional cask"
required: false
type: string
request_id:
description: "Unique caller-generated ID used to identify this workflow run"
required: false
type: string
permissions:
contents: write
jobs:
update-formula:
runs-on: macos-15
steps:
- name: Checkout tap repository
uses: actions/checkout@v6
- name: Setup Git
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Update formula
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
args=(
--formula "${{ inputs.formula }}"
--tag "${{ inputs.tag }}"
--repository "${{ inputs.repository }}"
)
if [ -n "${{ inputs.description }}" ]; then
args+=(--description "${{ inputs.description }}")
fi
if [ -n "${{ inputs.macos_artifact }}" ]; then
args+=(--macos-artifact "${{ inputs.macos_artifact }}")
fi
if [ -n "${{ inputs.linux_url }}" ]; then
args+=(--linux-url "${{ inputs.linux_url }}")
fi
if [ -n "${{ inputs.artifact_template }}" ]; then
args+=(--artifact-template "${{ inputs.artifact_template }}")
fi
if [ -n "${{ inputs.artifact_url }}" ]; then
args+=(--artifact-url "${{ inputs.artifact_url }}")
fi
if [ -n "${{ inputs.target_aliases }}" ]; then
args+=(--target-aliases "${{ inputs.target_aliases }}")
fi
if [ -n "${{ inputs.cask }}" ]; then
args+=(--cask "${{ inputs.cask }}")
fi
if [ -n "${{ inputs.cask_artifact }}" ]; then
args+=(--cask-artifact "${{ inputs.cask_artifact }}")
fi
python3 .github/scripts/update_formula.py "${args[@]}"
- name: Commit and push
run: |
FORMULA="${{ inputs.formula }}"
TAG="${{ inputs.tag }}"
CASK="${{ inputs.cask }}"
git add "Formula/${FORMULA}.rb"
if [ -n "$CASK" ]; then
git add "Casks/${CASK}.rb"
fi
if git diff --cached --quiet; then
echo "Formula/${FORMULA}.rb${CASK:+ and Casks/${CASK}.rb} already up to date"
exit 0
fi
if [ -n "$CASK" ]; then
git commit -m "${FORMULA}: update formula and cask for ${TAG}"
else
git commit -m "${FORMULA}: update formula for ${TAG}"
fi
git push