Skip to content
Merged
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
55 changes: 55 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Release XCFrameworks

on:
release:
types: [published]
workflow_dispatch:
inputs:
tag:
description: 'Release tag to upload assets to (leave empty for dry run)'
required: false
type: string

permissions:
contents: write

jobs:
build_xcframeworks:
if: github.repository == 'ml-explore/mlx-swift'
runs-on: [self-hosted, macos]
steps:
- uses: actions/checkout@v6
with:
submodules: recursive

- name: Verify MetalToolchain installed
shell: bash
run: xcodebuild -showComponent MetalToolchain

- name: Build XCFrameworks
shell: bash
env:
DEVELOPER_DIR: /Applications/Xcode-latest.app
working-directory: xcode
run: |
xcodebuild -version
../tools/create-xcframework.sh

- name: Create archives
shell: bash
working-directory: xcode/build/output
run: |
for framework in MLX Cmlx MLXNN MLXOptimizers; do
zip -r -y "${framework}.xcframework.zip" "${framework}.xcframework"
done

- name: Upload XCFrameworks to release
if: github.event.release.tag_name || inputs.tag
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hopefully this part works -- the repo doesn't have such a secret but maybe this is automatic? I am not sure how to test the run of the action until it is merged. No worries, this is new so can't break anything existing :-)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So it goes with GitHub Actions #yolo 🥲

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thrilled to see that the first run succeeded in building the framework! Looks like it stopped just shy of attaching it to a release. Excited to see what happens when it triggers on the next release.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I did the dry run variant -- otherwise it looked like it would build main and attach to the current release (which is a few commits back). Hopefully today.

run: |
gh release upload "${{ github.event.release.tag_name || inputs.tag }}" \
xcode/build/output/MLX.xcframework.zip \
xcode/build/output/Cmlx.xcframework.zip \
xcode/build/output/MLXNN.xcframework.zip \
xcode/build/output/MLXOptimizers.xcframework.zip