From 18f2a52603a377b50b4291d8e602473a8bcb4630 Mon Sep 17 00:00:00 2001 From: Andy Feller Date: Thu, 26 Oct 2023 16:05:27 -0400 Subject: [PATCH] Add go.mod support These changes add `go_version_file` input to define path to `go.mod` or `go.work` file containing the Go version to use. --- action.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index faf0c7f..ddadfd3 100644 --- a/action.yml +++ b/action.yml @@ -9,7 +9,8 @@ inputs: description: "GitHub token to use, defaults to `github.token` if unspecified" go_version: description: "The Go version to use for compiling (supports semver spec and ranges)" - default: "1.18" + go_version_file: + description: Path to the go.mod or go.work file to determine version of go to use gpg_fingerprint: description: "GPG fingerprint to use for signing releases" release_tag: @@ -25,7 +26,13 @@ runs: # TODO: figure out how to avoid setting up Go for non-Go extensions - uses: actions/setup-go@v3 with: - go-version: ${{ inputs.go_version }} + # The default go version is managed here because actions/setup-go favors go-version over go-version-file, + # requiring us to only pass it if no other inputs are provided. + # + # Otherwise, we pass along the values given, letting the user catch the warning notice in the logs + # and picking either go-version or go-version-file. + go-version: ${{(inputs.go_version_file == '' && inputs.go_version == '') && '1.18' || inputs.go_version}} + go-version-file: ${{inputs.go_version_file}} - id: determine_token run: |