From 818723587f041a921450ba8adf4e69063a18d821 Mon Sep 17 00:00:00 2001 From: Danny McCormick Date: Tue, 13 Aug 2019 16:31:11 -0400 Subject: [PATCH] Update to use go-version (#10) --- README.md | 6 +++--- action.yml | 5 ++++- lib/setup-go.js | 5 ++++- src/setup-go.ts | 5 ++++- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 79e5f8e..13981cf 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ This action sets up a go environment for use in actions by: -- optionally downloading and caching a version of go by version and adding to PATH +- optionally downloading and caching a version of Go by version and adding to PATH - registering problem matchers for error output # Usage @@ -19,7 +19,7 @@ steps: - uses: actions/checkout@master - uses: actions/setup-go@v1 with: - version: '1.9.3' // The Go version to download (if necessary) and use. + go-version: '1.9.3' // The Go version to download (if necessary) and use. - run: go run hello.go ``` @@ -37,7 +37,7 @@ jobs: - name: Setup go uses: actions/setup-go@v1 with: - version: ${{ matrix.go }} + go-version: ${{ matrix.go }} - run: go run hello.go ``` diff --git a/action.yml b/action.yml index 3c7d759..f4dddb7 100644 --- a/action.yml +++ b/action.yml @@ -2,9 +2,12 @@ name: 'Setup Go environment' description: 'Setup a Go environment and add it to the PATH, additionally providing proxy support' author: 'GitHub' inputs: - version: + go-version: description: 'The Go version to download (if necessary) and use. Example: 1.9.3' default: '1.10' +# Deprecated option, do not use. Will not be supported after October 1, 2019 + version: + description: 'Deprecated. Use go-version instead. Will not be supported after October 1, 2019' runs: using: 'node12' main: 'lib/setup-go.js' diff --git a/lib/setup-go.js b/lib/setup-go.js index fa24b36..34d85a1 100644 --- a/lib/setup-go.js +++ b/lib/setup-go.js @@ -25,7 +25,10 @@ function run() { // Version is optional. If supplied, install / use from the tool cache // If not supplied then task is still used to setup proxy, auth, etc... // - const version = core.getInput('version'); + let version = core.getInput('version'); + if (!version) { + version = core.getInput('go-version'); + } if (version) { yield installer.getGo(version); } diff --git a/src/setup-go.ts b/src/setup-go.ts index d8b2225..f292196 100644 --- a/src/setup-go.ts +++ b/src/setup-go.ts @@ -8,7 +8,10 @@ async function run() { // Version is optional. If supplied, install / use from the tool cache // If not supplied then task is still used to setup proxy, auth, etc... // - const version = core.getInput('version'); + let version = core.getInput('version'); + if (!version) { + version = core.getInput('go-version'); + } if (version) { await installer.getGo(version); }