Skip to content

Commit 983465b

Browse files
fix: automatically detect arm64 (#125)
1 parent f2dba72 commit 983465b

4 files changed

Lines changed: 19 additions & 5 deletions

File tree

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
strategy:
1111
fail-fast: false
1212
matrix:
13-
os: [macos-latest, windows-latest, ubuntu-latest]
13+
os: [macos-latest, windows-latest, ubuntu-latest, ubuntu-24.04-arm]
1414
steps:
1515
- name: Checkout
1616
uses: actions/[email protected]

dist/index.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32123,12 +32123,18 @@ const isWindows = (platform) => {
3212332123
return platform === 'windows';
3212432124
};
3212532125
const getPlatform = (os) => {
32126-
var _a;
32126+
var _a, _b;
3212732127
if (isValidPlatform(os)) {
3212832128
core.info(`==> ${os} OS provided`);
3212932129
return os;
3213032130
}
32131-
const platform = (_a = process.env.RUNNER_OS) === null || _a === void 0 ? void 0 : _a.toLowerCase();
32131+
let platform = (_a = process.env.RUNNER_OS) === null || _a === void 0 ? void 0 : _a.toLowerCase();
32132+
// handle arm64
32133+
const arch = (_b = process.env.RUNNER_ARCH) === null || _b === void 0 ? void 0 : _b.toLowerCase();
32134+
// macos version is universal, so we don't need to add -arm64
32135+
if (arch === 'arm64' && platform !== 'macos') {
32136+
platform += '-arm64';
32137+
}
3213232138
if (isValidPlatform(platform)) {
3213332139
core.info(`==> ${platform} OS detected`);
3213432140
return platform;

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/helpers.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,15 @@ const getPlatform = (os?: string): string => {
4949
return os;
5050
}
5151

52-
const platform = process.env.RUNNER_OS?.toLowerCase();
52+
let platform = process.env.RUNNER_OS?.toLowerCase();
53+
54+
// handle arm64
55+
const arch = process.env.RUNNER_ARCH?.toLowerCase();
56+
// macos version is universal, so we don't need to add -arm64
57+
if (arch === 'arm64' && platform !== 'macos') {
58+
platform += '-arm64';
59+
}
60+
5361
if (isValidPlatform(platform)) {
5462
core.info(`==> ${platform} OS detected`);
5563
return platform;

0 commit comments

Comments
 (0)