Skip to content

Commit

Permalink
ci(homebrew): add arm support in Homebrew
Browse files Browse the repository at this point in the history
  • Loading branch information
hituzi-no-sippo committed Sep 24, 2024
1 parent 74c82c0 commit e578b4c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,12 @@ jobs:

- name: Upload aarch64
uses: taiki-e/upload-rust-binary-action@v1
id: upload-aarch64
with:
bin: tera
target: aarch64-apple-darwin
archive: tera-cli-$target
checksum: sha512
checksum: sha256,sha512
token: ${{ secrets.GITHUB_TOKEN }}

- name: Add tera to PATH
Expand All @@ -194,6 +195,8 @@ jobs:
x86_64_sha256="$(cut -d' ' -f1 ${{ steps.upload-x86_64.outputs.sha256 }})"
echo "x86_64_sha256=$x86_64_sha256" >> $GITHUB_OUTPUT
aarch64_sha256="$(cut -d' ' -f1 ${{ steps.upload-aarch64.outputs.sha256 }})"
echo "aarch64_sha256=$aarch64_sha256" >> $github_output
# We do that before hecking out master (in case we were not in master already)
- name: Prepare new Formula
Expand All @@ -202,8 +205,8 @@ jobs:
DESCRIPTION: "A command line utility written in Rust to render templates using the tera templating engine"
HOMEPAGE: ${{ github.server_url }}/${{ github.repository }}
REPO_URL: ${{ github.server_url }}/${{ github.repository }}
ARCHIVE: tera-cli-x86_64-apple-darwin.tar.gz
SHA256: ${{ steps.output-values-for-templates.outputs.x86_64_sha256 }}
X86_64_SHA256: ${{ steps.output-values-for-templates.outputs.x86_64_sha256 }}
AARCH64_SHA256: ${{ steps.output-values-for-templates.outputs.aarch64_sha256 }}
VERSION: ${{ steps.output-values-for-templates.outputs.raw_version }}
run: |
tera --version
Expand Down
8 changes: 6 additions & 2 deletions templates/formula.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@
{%- set HOMEPAGE = HOMEPAGE | default(value=SITE ~ "/" ~ REPO) -%}
class {{ NAME }} < Formula
arch arm: "aarch64", intel: 'x86_64'
desc "{{ DESCRIPTION }}"
homepage "{{ HOMEPAGE }}"
url "{{ REPO_URL }}/releases/download/v{{ VERSION }}/{{ ARCHIVE }}"
sha256 "{{ SHA256 }}"
url "{{ SITE }}/{{ REPO }}/releases/download/v{{ VERSION }}/tera-cli-#{arch}-apple-darwin.tar.gz"
sha256 arm: "{{ AARCH64_SHA256 }}",
intel: "{{ X86_64_SHA256 }}"
version "{{ VERSION }}"
def install
Expand Down

0 comments on commit e578b4c

Please sign in to comment.