update-formula #23
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |