Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP: Support ARM macOS too
Browse files Browse the repository at this point in the history
samhh committed Jul 24, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 828fdbc commit 359580a
Showing 4 changed files with 42 additions and 7 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -6,13 +6,16 @@ on:
jobs:
test:
name: Test
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
runner:
- ubuntu-latest
- macos-latest
version:
- 0.8.0
- 0.8.3
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v4
- uses: ./
22 changes: 20 additions & 2 deletions dist/index.js
Original file line number Diff line number Diff line change
@@ -30544,14 +30544,32 @@ var core = __nccwpck_require__(9093);
var tool_cache = __nccwpck_require__(5561);
;// CONCATENATED MODULE: external "node:fs"
const external_node_fs_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:fs");
;// CONCATENATED MODULE: external "node:os"
const external_node_os_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:os");
;// CONCATENATED MODULE: ./src/main.ts



const downloadURL = (version) => `https://github.com/unsplash/intlc/releases/download/v${version}/intlc-v${version}-linux-x86_64`;

const getDownloadURL = (version) => {
const sys = `${external_node_os_namespaceObject.platform()} ${external_node_os_namespaceObject.arch()}`;
const prefix = `https://github.com/unsplash/intlc/releases/download/v${version}/intlc-v${version}`;
switch (sys) {
case "linux x64":
return `${prefix}-linux-x86_64`;
case "darwin arm64":
return `${prefix}-macos-aarch64`;
default: {
core.setFailed(`Unsupported os/arch pair: ${sys}`);
return null;
}
}
};
const main = async () => {
const version = core.getInput("version");
const url = downloadURL(version);
const url = getDownloadURL(version);
if (url === null)
return;
core.info(`Downloading v${version} from ${url}`);
const temporary = await tool_cache.downloadTool(url);
core.debug(`Setting permissions on ${temporary}`);
2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

20 changes: 17 additions & 3 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,27 @@
import * as core from "@actions/core";
import * as tc from "@actions/tool-cache";
import * as fs from "node:fs";
import * as os from "node:os";

const downloadURL = (version: string): string =>
`https://github.com/unsplash/intlc/releases/download/v${version}/intlc-v${version}-linux-x86_64`;
const getDownloadURL = (version: string): string | null => {
const sys = `${os.platform()} ${os.arch()}`;
const prefix = `https://github.com/unsplash/intlc/releases/download/v${version}/intlc-v${version}`;
switch (sys) {
case "linux x64":
return `${prefix}-linux-x86_64`;
case "darwin arm64":
return `${prefix}-macos-aarch64`;
default: {
core.setFailed(`Unsupported os/arch pair: ${sys}`);
return null;
}
}
};

const main = async (): Promise<void> => {
const version = core.getInput("version");
const url = downloadURL(version);
const url = getDownloadURL(version);
if (url === null) return;

core.info(`Downloading v${version} from ${url}`);
const temporary = await tc.downloadTool(url);

0 comments on commit 359580a

Please sign in to comment.