Skip to content

Commit

Permalink
fix: platform detection
Browse files Browse the repository at this point in the history
  • Loading branch information
crazy-max committed Aug 26, 2021
1 parent 1bdedc7 commit ede4161
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 4 deletions.
35 changes: 33 additions & 2 deletions dist/index.js

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

35 changes: 33 additions & 2 deletions src/installer.ts
Expand Up @@ -46,8 +46,39 @@ export async function getGoReleaser(distribution: string, version: string): Prom
}

const getFilename = (distribution: string): string => {
const platform: string = osPlat == 'win32' ? 'Windows' : osPlat == 'darwin' ? 'Darwin' : 'Linux';
const arch: string = osArch == 'x64' ? 'x86_64' : 'i386';
let platform, arch: string;
switch (osPlat) {
case 'linux': {
platform = 'Linux';
break;
}
case 'darwin': {
platform = 'Darwin';
break;
}
case 'win32': {
platform = 'Windows';
break;
}
default: {
platform = osPlat;
break;
}
}
switch (osArch) {
case 'x64': {
arch = 'x86_64';
break;
}
case 'x32': {
arch = 'i386';
break;
}
default: {
arch = osArch;
break;
}
}
const ext: string = osPlat == 'win32' ? 'zip' : 'tar.gz';
const suffix: string = pro.suffix(distribution);
return util.format('goreleaser%s_%s_%s.%s', suffix, platform, arch, ext);
Expand Down

0 comments on commit ede4161

Please sign in to comment.