Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Universal builds for macOS #1820

Merged
merged 4 commits into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions .github/workflows/ci-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,67 @@ jobs:
asset_path: alr-bin-macos.zip
asset_name: alr-${{ steps.get_version.outputs.version-without-v }}-bin-${{ steps.get_arch.outputs.arch }}-macos.zip
asset_content_type: application/zip

build-macos-universal:
runs-on: macos-latest
needs: [build]
steps:
- name: Install Python 3.x (required for releaser)
uses: actions/setup-python@v5
with:
python-version: '3.x'

- name: download x86_64
uses: robinraju/release-downloader@v1
with:
fileName: '*-x86_64-macos.zip'
latest: true
preRelease: true
out-file-path: 'x86_64'
extract: true

- name: download aarch64
uses: robinraju/release-downloader@v1
with:
latest: true
preRelease: true
fileName: '*-aarch64-macos.zip'
out-file-path: 'aarch64'
extract: true

- name: Create universal binary
run: |
mkdir bin
lipo x86_64/bin/alr aarch64/bin/alr -create -output bin/alr
chmod +x bin/alr
cp aarch64/LICENSE.txt .
zip alr-bin-macos.zip bin/alr LICENSE.txt
simonjwright marked this conversation as resolved.
Show resolved Hide resolved

# Release steps

# I think I have to run these first two again, because
# the previous uses are in a different job?

- name: Retrieve upload URL for the release
if: github.event_name == 'release'
id: get_release
uses: bruceadams/get-release@v1.3.2
env:
GITHUB_TOKEN: ${{ github.token }}

- name: Get release version
id: get_version
if: github.event_name == 'release'
uses: battila7/get-version-action@v2

- name: Upload release assets
if: github.event_name == 'release'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_release.outputs.upload_url }}
asset_path: alr-bin-macos.zip
asset_name: alr-${{ steps.get_version.outputs.version-without-v }}-bin-universal-macos.zip
asset_content_type: application/zip

47 changes: 47 additions & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ jobs:
- name: Package binaries (macOS/x64)
if: startsWith(matrix.os, 'macos') && runner.arch == 'X64'
run: zip alr-nightly-bin-x86_64-macos.zip bin/alr* LICENSE.txt alr-*.txt

- name: Package binaries (macOS/arm64)
if: startsWith(matrix.os, 'macos') && runner.arch == 'ARM64'
run: zip alr-nightly-bin-aarch64-macos.zip bin/alr* LICENSE.txt alr-*.txt
Expand All @@ -113,3 +114,49 @@ jobs:
alr-nightly-*.zip
tag: nightly
rm: false

build-macos-universal:
runs-on: macos-latest
needs: [build]
steps:
- name: Install Python 3.x (required for releaser)
uses: actions/setup-python@v5
with:
python-version: '3.x'

- name: download x86_64
uses: robinraju/release-downloader@v1
with:
fileName: '*-x86_64-macos.zip'
latest: true
preRelease: true
out-file-path: 'x86_64'
extract: true

- name: download aarch64
uses: robinraju/release-downloader@v1
with:
latest: true
preRelease: true
fileName: '*-aarch64-macos.zip'
out-file-path: 'aarch64'
extract: true

- name: Create universal binary
run: |
mkdir universal
# copy extra files from aarch64 (and bin/alr, to be overwritten)
cp -pR aarch64/* universal
lipo x86_64/bin/alr aarch64/bin/alr -create -output universal/bin/alr
ls -l universal/bin/alr
chmod +x universal/bin/alr
(cd universal; zip ../alr-nightly-bin-universal-macos.zip bin/alr LICENSE.txt alr-*.txt)

- name: Upload to release
uses: pyTooling/Actions/releaser/composite@main
with:
token: ${{ secrets.GITHUB_TOKEN }}
files: |
alr-nightly-bin-universal-macos.zip
tag: nightly
rm: false
Loading