-
Notifications
You must be signed in to change notification settings - Fork 0
108 lines (93 loc) · 3.83 KB
/
update-formula.yml
File metadata and controls
108 lines (93 loc) · 3.83 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
name: Update Homebrew Formula
on:
repository_dispatch:
types: [update-formula]
jobs:
update-formula:
runs-on: ubuntu-latest
steps:
- name: Checkout homebrew-tap
uses: actions/checkout@v4
- name: Extract payload
id: payload
run: |
echo "version=${{ github.event.client_payload.version }}" >> "$GITHUB_OUTPUT"
echo "sha_macos_arm64=${{ github.event.client_payload.sha_macos_arm64 }}" >> "$GITHUB_OUTPUT"
echo "sha_linux_x86=${{ github.event.client_payload.sha_linux_x86 }}" >> "$GITHUB_OUTPUT"
echo "sha_jvm=${{ github.event.client_payload.sha_jvm }}" >> "$GITHUB_OUTPUT"
- name: Generate formula
env:
TAG: ${{ steps.payload.outputs.version }}
SHA_MACOS_ARM64: ${{ steps.payload.outputs.sha_macos_arm64 }}
SHA_LINUX_X86: ${{ steps.payload.outputs.sha_linux_x86 }}
SHA_JVM: ${{ steps.payload.outputs.sha_jvm }}
run: |
envsubst '$TAG $SHA_MACOS_ARM64 $SHA_LINUX_X86 $SHA_JVM' > Formula/riddlc.rb << 'FORMULA'
# Homebrew formula for riddlc - the RIDDL compiler
# To install: brew install ossuminc/tap/riddlc
# Or add the tap first: brew tap ossuminc/tap && brew install riddlc
# Auto-generated by update-formula.yml - do not edit manually
class Riddlc < Formula
desc "Compiler for RIDDL (Reactive Interface to Domain Definition Language)"
homepage "https://github.com/ossuminc/riddl"
version "${TAG}"
license "Apache-2.0"
if OS.mac? && Hardware::CPU.arm?
url "https://github.com/ossuminc/riddl/releases/download/#{version}/riddlc-macos-arm64.zip"
sha256 "${SHA_MACOS_ARM64}"
elsif OS.linux? && Hardware::CPU.intel?
url "https://github.com/ossuminc/riddl/releases/download/#{version}/riddlc-linux-x86_64.zip"
sha256 "${SHA_LINUX_X86}"
else
url "https://github.com/ossuminc/riddl/releases/download/#{version}/riddlc.zip"
sha256 "${SHA_JVM}"
depends_on "openjdk@21"
end
def install
if (OS.mac? && Hardware::CPU.arm?) || (OS.linux? && Hardware::CPU.intel?)
# Native binary - Homebrew strips the single top-level "bin/" dir
bin.install "riddlc"
else
# JVM version - needs wrapper script
rm "bin/riddlc.bat"
libexec.install "lib"
libexec.install "bin"
(bin/"riddlc").write <<~EOS
#!/bin/bash
export JAVA_HOME="#{Formula["openjdk@21"].opt_prefix}"
exec "#{libexec}/bin/riddlc" "$@"
EOS
end
end
def caveats
if (OS.mac? && Hardware::CPU.arm?) || (OS.linux? && Hardware::CPU.intel?)
<<~EOS
riddlc is installed as a native binary. No JDK required.
To verify the installation:
riddlc version
For help:
riddlc help
EOS
else
<<~EOS
riddlc requires Java 21. This formula uses openjdk@21.
To verify the installation:
riddlc version
For help:
riddlc help
EOS
end
end
test do
assert_match "riddlc version", shell_output("#{bin}/riddlc version")
end
end
FORMULA
- name: Commit and push formula
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
TAG="${{ steps.payload.outputs.version }}"
git add Formula/riddlc.rb
git diff --cached --quiet || git commit -m "Update riddlc to ${TAG} with multi-platform native binaries"
git push