Compile and upload MacOS binaries #8
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
name: Compile and upload MacOS binaries | |
on: | |
workflow_dispatch: | |
jobs: | |
mac-x86: | |
runs-on: macos-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Use Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 16 | |
- name: Use Rust | |
uses: actions-rs/toolchain@v1.0.6 | |
with: | |
toolchain: stable | |
- name: Build module | |
env: | |
MACOSX_DEPLOYMENT_TARGET: 10.13 | |
run: | | |
npm ci --ignore-scripts | |
npm run build -- --release --features metal,window | |
- name: Package module | |
run: | | |
npm test && npm run package | |
- name: Upload | |
env: | |
NODE_PRE_GYP_GITHUB_TOKEN: ${{ secrets.DEPLOY_TOKEN }} | |
run: | | |
npm run upload | |
mac-arm64: | |
runs-on: macos-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Use Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 16 | |
- name: Use Rust | |
uses: actions-rs/toolchain@v1.0.6 | |
with: | |
target: aarch64-apple-darwin | |
toolchain: nightly | |
override: true | |
- name: Select SDK | |
run: | | |
SDK=$(xcodebuild -showsdks -json | jq -r '.[] | .canonicalName' | grep '^macosx' | tail -n 1) | |
echo "SDKROOT=$(xcrun -sdk $SDK --show-sdk-path)" >> $GITHUB_ENV | |
- name: Build & package module | |
env: | |
MACOSX_DEPLOYMENT_TARGET: 11.1 | |
run: | | |
npm ci --ignore-scripts | |
npm run build -- --release --features metal,window --target aarch64-apple-darwin | |
sed -i.bak 's/"package_name":.*/"package_name": "{platform}-arm64-{node_napi_label}-{libc}.tar.gz",/' package.json | |
npm run package | |
- name: Upload | |
env: | |
NODE_PRE_GYP_GITHUB_TOKEN: ${{ secrets.DEPLOY_TOKEN }} | |
run: | | |
npm run upload |