diff --git a/dist/index.js b/dist/index.js index f782923..fa3e82e 100644 --- a/dist/index.js +++ b/dist/index.js @@ -29,6 +29,9 @@ var __importStar = (this && this.__importStar) || function (mod) { __setModuleDefault(result, mod); return result; }; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getAssetName = exports.getRepo = exports.CarvelReleasesService = void 0; const gha_installer_1 = __nccwpck_require__(631); @@ -36,6 +39,7 @@ const crypto = __importStar(__nccwpck_require__(6113)); const path = __importStar(__nccwpck_require__(1017)); const fs = __importStar(__nccwpck_require__(7147)); const core = __importStar(__nccwpck_require__(2186)); +const os_1 = __importDefault(__nccwpck_require__(2037)); class CarvelReleasesService extends gha_installer_1.GitHubReleasesService { constructor(core, env, fs, octokit) { super(core, env, octokit, { repo: getRepo, assetName: getAssetName }); @@ -84,13 +88,18 @@ function getAssetName(platform, app) { } exports.getAssetName = getAssetName; function getAssetSuffix(platform) { - switch (platform) { - case 'win32': + const arch = os_1.default.arch(); + switch (`${platform}-${arch}`) { + case 'win32-x64': return 'windows-amd64.exe'; - case 'darwin': + case 'darwin-x64': return 'darwin-amd64'; - default: + case 'linux-x64': return 'linux-amd64'; + case 'linux-arm64': + return 'linux-arm64'; + default: + throw new Error(`Unsupported platform-arch combination: ${platform}-${arch}`); } } diff --git a/src/carvel_releases_service.ts b/src/carvel_releases_service.ts index c6cf7a4..8548056 100644 --- a/src/carvel_releases_service.ts +++ b/src/carvel_releases_service.ts @@ -15,6 +15,7 @@ import * as crypto from 'crypto' import * as path from 'path' import * as fs from 'fs' import * as core from '@actions/core' +import os from 'os'; export class CarvelReleasesService extends GitHubReleasesService { private _fs: FileSystem @@ -85,12 +86,17 @@ export function getAssetName(platform: string, app: AppInfo): string { } function getAssetSuffix(platform: string): string { - switch (platform) { - case 'win32': + const arch = os.arch() + switch (`${platform}-${arch}`) { + case 'win32-x64': return 'windows-amd64.exe' - case 'darwin': + case 'darwin-x64': return 'darwin-amd64' - default: + case 'linux-x64': return 'linux-amd64' + case 'linux-arm64': + return 'linux-arm64' + default: + throw new Error(`Unsupported platform-arch combination: ${platform}-${arch}`) } }