Skip to content

Commit bef824d

Browse files
committed
Setup intel support for MacOS
1 parent 34ca73a commit bef824d

File tree

1 file changed

+39
-9
lines changed

1 file changed

+39
-9
lines changed

.github/workflows/publish.yml

Lines changed: 39 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -329,8 +329,18 @@ jobs:
329329
env:
330330
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
331331

332-
macos:
333-
runs-on: macos-latest
332+
macos-build:
333+
# We use macos-13 since it's the latest image that currently supports AMD64
334+
strategy:
335+
matrix:
336+
include:
337+
- os: macos-13
338+
arch: amd64
339+
- os: macos-latest
340+
arch: arm64
341+
runs-on: ${{ matrix.os }}
342+
outputs:
343+
sha256-${{ matrix.arch }}: ${{ steps.checksum.outputs.sha256 }}
334344

335345
steps:
336346
- name: Checkout source
@@ -353,18 +363,26 @@ jobs:
353363
354364
- name: Generate SHA256
355365
id: checksum
366+
env:
367+
ARCHITECTURE: ${{ matrix.arch }}
356368
run: |
357-
FILENAME=gitmastery
369+
FILENAME="gitmastery-$ARCHITECTURE"
358370
SHA256=$(shasum -a 256 dist/$FILENAME | cut -d ' ' -f1)
359371
echo "sha256=$SHA256" >> $GITHUB_OUTPUT
360372
361373
- name: Create GitHub Release
362374
uses: softprops/action-gh-release@v2
363375
with:
364-
files: dist/gitmastery
376+
files: dist/gitmastery-${{ matrix.arch }}
365377
env:
366378
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
367379

380+
macos-publish:
381+
runs-on: ubuntu-latest
382+
383+
needs: macos-build
384+
385+
steps:
368386
- name: Update Homebrew Tap
369387
env:
370388
GH_TOKEN: ${{ secrets.ORG_PAT }}
@@ -374,19 +392,31 @@ jobs:
374392
375393
git clone https://x-access-token:${GH_TOKEN}@github.com/git-mastery/homebrew-gitmastery.git
376394
cd homebrew-gitmastery
377-
ls
378395
379396
cat <<EOF > gitmastery.rb
380397
class Gitmastery < Formula
381398
desc "CLI tool for Git-Mastery"
382399
homepage "https://github.com/git-mastery/cli"
383-
url "https://github.com/git-mastery/cli/releases/download/${GITHUB_REF_NAME}/gitmastery"
384-
sha256 "${{ steps.checksum.outputs.sha256 }}"
385400
version "${GITHUB_REF_NAME#v}"
386401
402+
on_arm do
403+
url "https://github.com/git-mastery/cli/releases/download/${GITHUB_REF_NAME}/gitmastery-arm64"
404+
sha256 "${{ needs.build.outputs.sha256-arm64 }}"
405+
end
406+
407+
on_intel do
408+
url "https://github.com/git-mastery/cli/releases/download/${GITHUB_REF_NAME}/gitmastery-amd64"
409+
sha256 "${{ needs.build.outputs.sha256-amd64 }}"
410+
end
411+
387412
def install
388-
chmod 0755, "gitmastery"
389-
bin.install "gitmastery"
413+
if Hardware::CPU.arm?
414+
chmod 0755, "gitmastery-arm64"
415+
bin.install "gitmastery-arm64" => "gitmastery"
416+
else
417+
chmod 0755, "gitmastery-amd64"
418+
bin.install "gitmastery-amd64" => "gitmastery"
419+
end
390420
end
391421
392422
test do

0 commit comments

Comments
 (0)