-
Notifications
You must be signed in to change notification settings - Fork 39
76 lines (63 loc) · 2.65 KB
/
update_klotho_oss_formula.yaml
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
name: Update the klotho-oss homebrew formula
on:
release:
types:
- released
workflow_dispatch:
inputs:
klotho-tap:
description: 'klotho homebrew tap repository'
required: false
default: 'KlothoPlatform/homebrew-tap'
klotho-release:
description: 'the klotho (OSS) release that the formula will point to (e.g. v0.5.15)'
required: false
jobs:
update-brew-formula:
runs-on: ubuntu-latest
steps:
- name: get release name
id: releaseName
env:
GH_TOKEN: ${{ github.token }}
run: |
if [ -z "${{ github.event.inputs.klotho-release }}" ]; then
tag_name="$(echo "$GITHUB_REF" | cut -d/ -f3)" # e.g. "v0.5.16"
release_name=$(gh release -R ${GITHUB_REPOSITORY} view ${tag_name} --json "name,body" | jq -r '.name')
echo "using release ${release_name}"
else
release_name="${{ github.event.inputs.klotho-release }}"
fi
printf 'release_name=%s\n' "$release_name" >> $GITHUB_OUTPUT
- name: clone klotho tap
env:
GH_TOKEN: ${{ github.token }}
run: gh repo clone ${{ github.event.inputs.klotho-tap || 'KlothoPlatform/homebrew-tap' }} tap -- -b main --depth 1
- name: download release artifacts
env:
GH_TOKEN: ${{ github.token }}
run: |
cd tap
gh release download ${{ steps.releaseName.outputs.release_name }} -R "${GITHUB_REPOSITORY}" -p 'klotho_*'
- name: update klotho brew formula
run: |
cd tap
export VERSION=${{ steps.releaseName.outputs.release_name }}
echo "Preparing formula for klotho release: ${VERSION}"
export FORMULA_NAME=KlothoOss
export OUTPUT_FILE_NAME=klotho-oss.rb
export BINARY_BASE_URL="https://github.com/klothoplatform/klotho/releases/download"
./update_formula.sh
- name: setup git config
run: |
cd tap
git config user.name "GitHub Actions Bot"
git config user.email "<>"
git remote set-url origin https://x-access-token:${{ secrets.HOMEBREW_KLOTHO_MODIFY_TOKEN }}@github.com/${{ github.event.inputs.klotho-tap || 'KlothoPlatform/homebrew-tap' }}
- name: push updated formula
run: |
cd tap
echo "Pushing updated klotho-oss formula to ${{ github.event.inputs.klotho-tap || 'KlothoPlatform/homebrew-tap' }}/main"
git add Formula/klotho.rb
git commit -m "Updates klotho-oss formula to ${{ steps.releaseName.outputs.release_name }}"
git push origin main