macOS SDK Sysroot #9
This file contains 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
on: | |
workflow_dispatch: | |
inputs: | |
macos_sdk_version: | |
description: "Version of the macOS SDK to package." | |
type: string | |
required: true | |
github_tag: | |
description: "Tag to upload the release to." | |
type: string | |
required: true | |
name: macOS SDK Sysroot | |
jobs: | |
package_sdk: | |
name: Package macOS SDK | |
runs-on: macos-14 | |
permissions: | |
contents: write | |
steps: | |
- name: Clone MaterializeInc/toolchains repo | |
uses: actions/checkout@v4 | |
- name: List Available SDKs | |
run: | | |
ls -lAh /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs | |
ls -lAh /Applications/Xcode* | |
- name: Determine Path to SDK | |
run: | | |
SDK_NAME="MacOSX${{ inputs.macos_sdk_version }}.sdk" | |
SDK_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/$SDK_NAME | |
if [ ! -d "$SDK_PATH" ]; then | |
echo "$SDK_PATH does not exist." | |
exit 1 | |
fi | |
echo "SDK_NAME=$SDK_NAME" >> $GITHUB_ENV | |
echo "SDK_PATH=$SDK_PATH" >> $GITHUB_ENV | |
- name: Package SDK | |
run: | | |
mkdir working working/$SDK_NAME | |
mkdir artifacts | |
cp -rP $SDK_PATH/* working/$SDK_NAME | |
cat macos-sysroot/remove.txt | while read -r val; do eval rm -v working/$SDK_NAME/$val || true; done | |
cd working | |
tar -cf - $SDK_NAME/* | zstd --ultra -22 -o "../artifacts/$SDK_NAME.tar.zst" | |
cp -rP $SDK_PATH/* working/$SDK_NAME-min | |
cat macos-sysroot/min-remove.txt | while read -r val; do eval rm -rfv working/$SDK_NAME-min/$val || true; done | |
cat macos-sysroot/min-add.txt | while read -r val; do eval mkdir -p working/$SDK_NAME-min/$val && cp -r working/$SDK_NAME/$val working/$SDK_NAME-min/$val | |
cd working | |
tar -cf - $SDK_NAME/* | zstd --ultra -22 -o "../artifacts/$SDK_NAME-min.tar.zst" | |
- name: Determine Release Tag | |
run: | | |
RELEASE_TAG="macos-sysroot-sdk-${{ inputs.macos_sdk_version }}" | |
if [ -n "${{ inputs.github_tag }}" ]; then | |
RELEASE_TAG="${{ inputs.github_tag }}" | |
fi | |
echo "RELEASE_TAG=$RELEASE_TAG" >> $GITHUB_ENV | |
- name: Upload Artifacts to Release | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
file: "artifacts/*.tar.zst" | |
file_glob: true | |
tag: ${{ env.RELEASE_TAG }} | |
overwrite: true | |