Skip to content
This repository has been archived by the owner on Jul 30, 2024. It is now read-only.

Add support for MacOS on ARM #3

Merged
merged 7 commits into from
Dec 13, 2023
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
6 changes: 5 additions & 1 deletion .github/workflows/publish-node.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
name: Publish Node Addon

on:
workflow_dispatch:
# Enables manual triggering via GitHub Actions
push:
tags:
- 'v*'

jobs:
build:
timeout-minutes: 5
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]

steps:
- name: Check out the code
Expand Down Expand Up @@ -73,6 +76,7 @@ jobs:
mv ./artifacts/binary-ubuntu-latest/index-ubuntu-latest.node ./binaries/
mv ./artifacts/binary-windows-latest/index-windows-latest.node ./binaries/
mv ./artifacts/binary-macos-latest/index-macos-latest.node ./binaries/
mv ./artifacts/binary-macos-latest/index-macos-latest-large.node ./binaries/index-macos-arm-latest.node

- name: Publish to GitHub Packages
run: npm publish
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@robocorp/native-certs",
"version": "0.1.3",
"version": "0.2.0",
"description": "",
"main": "index.node",
"module": "index.node",
Expand Down
7 changes: 6 additions & 1 deletion postinstall.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const path = require('path');

const binariesDir = path.join(__dirname, 'binaries');
const osType = process.platform;
const cpuArch = process.arch;

let binaryName;
switch (osType) {
Expand All @@ -13,7 +14,11 @@ switch (osType) {
binaryName = 'index-ubuntu-latest.node';
break;
case 'darwin':
binaryName = 'index-macos-latest.node';
if (cpuArch === 'arm' || cpuArch === 'arm64') {
binaryName = 'index-macos-arm-latest.node';
} else {
binaryName = 'index-macos-latest.node';
}
break;
default:
throw new Error(`Unsupported platform: ${osType}`);
Expand Down