Skip to content

Commit

Permalink
fix: support arch variant to download GoReleaser (#309)
Browse files Browse the repository at this point in the history
Co-authored-by: CrazyMax <crazy-max@users.noreply.github.com>
  • Loading branch information
crazy-max and crazy-max committed Oct 3, 2021
1 parent cb1d514 commit 13b378d
Show file tree
Hide file tree
Showing 2 changed files with 199 additions and 3 deletions.
181 changes: 179 additions & 2 deletions dist/index.js

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

21 changes: 20 additions & 1 deletion src/installer.ts
Expand Up @@ -46,8 +46,27 @@ export async function getGoReleaser(distribution: string, version: string): Prom
}

const getFilename = (distribution: string): string => {
let arch: string;
switch (osArch) {
case 'x64': {
arch = 'x86_64';
break;
}
case 'x32': {
arch = 'i386';
break;
}
case 'arm': {
const arm_version = (process.config.variables as any).arm_version;
arch = arm_version ? 'armv' + arm_version : 'arm';
break;
}
default: {
arch = osArch;
break;
}
}
const platform: string = osPlat == 'win32' ? 'Windows' : osPlat == 'darwin' ? 'Darwin' : 'Linux';
const arch: string = osArch == 'x64' ? 'x86_64' : osArch == 'x32' ? 'i386' : osArch;
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 13b378d

Please sign in to comment.