Skip to content

Commit

Permalink
Update install.ts to use getArch() instead of process.arch
Browse files Browse the repository at this point in the history
  • Loading branch information
gorkem committed Mar 30, 2024
1 parent 846c161 commit 2703b80
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
6 changes: 3 additions & 3 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

13 changes: 9 additions & 4 deletions src/installer/install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,21 @@ import path from 'path'
import * as fs from 'fs'
import { KitArchiveFile, KitRelease } from '../types'
import { downloadFile } from './download'
import { getExecutableBinaryName, getOS, getTmpDir } from '../utils/utils'
import {
getArch,
getExecutableBinaryName,
getOS,
getTmpDir
} from '../utils/utils'
import { verifyHash } from './hash'

export async function downloadAndInstall(release: KitRelease): Promise<string> {
ghCore.debug(`Downloading and installing release ${JSON.stringify(release)}`)
ghCore.debug(`Downloading and installing release ${release.tag}`)
const files = release.assets
.filter(filterAssetsByOS)
.filter(filterAssetsByArch)
if (files.length === 0) {
throw new Error('No matching release found for this OS and architecture')
throw new Error(`No matching release found for ${getOS()} and ${getArch()}`)
}
const file = files[0]
const downloadPath = await downloadFile(file)
Expand Down Expand Up @@ -74,7 +79,7 @@ function filterAssetsByOS(file: KitArchiveFile): boolean {
}

function filterAssetsByArch(file: KitArchiveFile): boolean {
const arch = process.arch
const arch = getArch()
const lowerCaseFilename = file.archiveFilename.toLowerCase()
return lowerCaseFilename.includes(arch)
}

0 comments on commit 2703b80

Please sign in to comment.