Compare commits

..

2 Commits

Author SHA1 Message Date
9fbc767707 Merge pull request #30 from hross/master
Change getFileName to do architecture lookups and add arm support
2019-11-25 07:17:19 -05:00
0cbaec8e4b Change getFileName to do architecture lookups and add arm support 2019-11-21 10:23:32 -05:00
4 changed files with 24 additions and 6 deletions

View File

@ -16,7 +16,7 @@ See [action.yml](action.yml)
Basic:
```yaml
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@master
- uses: actions/setup-go@v1
with:
go-version: '1.9.3' # The Go version to download (if necessary) and use.
@ -33,7 +33,7 @@ jobs:
go: [ '1.8', '1.9.3', '1.10.x' ]
name: Go ${{ matrix.go }} sample
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@master
- name: Setup go
uses: actions/setup-go@v1
with:

View File

@ -1,5 +1,5 @@
name: 'Setup Go'
description: 'Set up a specific version of Go and add the command-line tools to the PATH'
name: 'Setup Go environment'
description: 'Setup a Go environment and add it to the PATH, additionally providing proxy support'
author: 'GitHub'
inputs:
go-version:

View File

@ -72,6 +72,7 @@ function acquireGo(version) {
//
let fileName = getFileName(version);
let downloadUrl = getDownloadUrl(fileName);
core.debug('Downloading Go from: ' + downloadUrl);
let downloadPath = null;
try {
downloadPath = yield tc.downloadTool(downloadUrl);
@ -102,8 +103,14 @@ function acquireGo(version) {
});
}
function getFileName(version) {
const arches = {
x64: 'amd64',
arm: 'armv6l',
arm64: 'arm64',
default: '386'
};
const platform = osPlat == 'win32' ? 'windows' : osPlat;
const arch = osArch == 'x64' ? 'amd64' : '386';
const arch = arches[osArch] || arches['default'];
const ext = osPlat == 'win32' ? 'zip' : 'tar.gz';
const filename = util.format('go%s.%s-%s.%s', version, platform, arch, ext);
return filename;

View File

@ -57,6 +57,9 @@ async function acquireGo(version: string): Promise<string> {
//
let fileName: string = getFileName(version);
let downloadUrl: string = getDownloadUrl(fileName);
core.debug('Downloading Go from: ' + downloadUrl);
let downloadPath: string | null = null;
try {
downloadPath = await tc.downloadTool(downloadUrl);
@ -89,8 +92,15 @@ async function acquireGo(version: string): Promise<string> {
}
function getFileName(version: string): string {
const arches: {[arch: string]: string} = {
x64: 'amd64',
arm: 'armv6l',
arm64: 'arm64',
default: '386'
};
const platform: string = osPlat == 'win32' ? 'windows' : osPlat;
const arch: string = osArch == 'x64' ? 'amd64' : '386';
const arch: string = arches[osArch] || arches['default'];
const ext: string = osPlat == 'win32' ? 'zip' : 'tar.gz';
const filename: string = util.format(
'go%s.%s-%s.%s',
@ -99,6 +109,7 @@ function getFileName(version: string): string {
arch,
ext
);
return filename;
}