Compare commits

...

5 Commits

Author SHA1 Message Date
63aa003870 Update README for semantic versioning 2019-11-08 16:51:08 +00:00
8dd2e77965 Update description 2019-11-08 16:50:57 +00:00
75259a5ae0 Merge pull request #20 from subosito/golang-dl
Use golang-dl release data
2019-09-16 15:42:36 +01:00
bc6edb526d update test assertion 2019-09-05 13:27:28 +07:00
21620fff65 use golang-dl release data 2019-09-05 13:09:55 +07:00
7 changed files with 10212 additions and 2501 deletions

View File

@ -16,7 +16,7 @@ See [action.yml](action.yml)
Basic:
```yaml
steps:
- uses: actions/checkout@master
- uses: actions/checkout@v1
- 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@master
- uses: actions/checkout@v1
- name: Setup go
uses: actions/setup-go@v1
with:

10196
__tests__/data/golang-dl.json Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -43,9 +43,10 @@ describe('installer tests', () => {
describe('the latest release of a go version', () => {
beforeEach(() => {
nock('https://api.github.com')
.get('/repos/golang/go/git/refs/tags')
.replyWithFile(200, path.join(dataDir, 'golang-tags.json'));
nock('https://golang.org')
.get('/dl/')
.query({mode: 'json', include: 'all'})
.replyWithFile(200, path.join(dataDir, 'golang-dl.json'));
});
afterEach(() => {
@ -79,7 +80,7 @@ describe('installer tests', () => {
it('Acquires latest release version of go if using 1.x and no matching version is installed', async () => {
await installer.getGo('1.x');
const goDir = path.join(toolDir, 'go', '1.13.0-beta1', os.arch());
const goDir = path.join(toolDir, 'go', '1.13.0', os.arch());
expect(fs.existsSync(`${goDir}.complete`)).toBe(true);
if (IS_WINDOWS) {

View File

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

View File

@ -186,10 +186,9 @@ function getLatestVersion(version) {
function getAvailableVersions() {
return __awaiter(this, void 0, void 0, function* () {
let rest = new restm.RestClient('setup-go');
let tags = (yield rest.get('https://api.github.com/repos/golang/go/git/refs/tags')).result || [];
return tags
.filter(tag => tag.ref.match(/go\d+\.[\w\.]+/g))
.map(tag => tag.ref.replace('refs/tags/go', ''));
let tags = (yield rest.get('https://golang.org/dl/?mode=json&include=all'))
.result || [];
return tags.map(tag => tag.version.replace('go', ''));
});
}
function getPossibleVersions(version) {

View File

@ -187,19 +187,16 @@ async function getLatestVersion(version: string): Promise<string> {
}
interface IGoRef {
ref: string;
version: string;
}
async function getAvailableVersions(): Promise<string[]> {
let rest: restm.RestClient = new restm.RestClient('setup-go');
let tags: IGoRef[] =
(await rest.get<IGoRef[]>(
'https://api.github.com/repos/golang/go/git/refs/tags'
)).result || [];
(await rest.get<IGoRef[]>('https://golang.org/dl/?mode=json&include=all'))
.result || [];
return tags
.filter(tag => tag.ref.match(/go\d+\.[\w\.]+/g))
.map(tag => tag.ref.replace('refs/tags/go', ''));
return tags.map(tag => tag.version.replace('go', ''));
}
async function getPossibleVersions(version: string): Promise<string[]> {