GitHub: make setup-go action more versatile

With this commit we allow the Go version that is set up to be
configurable and not dependent on a specific environment variable. This
will allow us to eventually extract the action into a tooling
repository.
This commit is contained in:
Oliver Gugger
2023-01-06 08:58:41 +01:00
parent c4ca7b99e2
commit 984fc3a2ec
2 changed files with 40 additions and 26 deletions

View File

@@ -1,14 +1,18 @@
# A resuable workflow that's used to setup the go enviroment and cache.
name: Setup go enviroment
name: "Setup Golang environment"
description: "A reusable workflow that's used to set up the Go environment and cache."
inputs:
go-version:
description: "The version of Golang to set up"
required: true
runs:
using: "composite"
steps:
- name: setup go ${{ env.GO_VERSION }}
- name: setup go ${{ inputs.go-version }}
uses: actions/setup-go@v3
with:
go-version: '${{ env.GO_VERSION }}'
go-version: '${{ inputs.go-version }}'
- name: go cache
uses: actions/cache@v3
@@ -23,9 +27,9 @@ runs:
~/.cache/go-build
~/Library/Caches/go-build
~\AppData\Local\go-build
key: ${{ runner.os }}-go-${{ env.GO_VERSION }}-${{ hashFiles('**/go.sum') }}
key: ${{ runner.os }}-go-${{ inputs.go-version }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-${{ env.GO_VERSION }}-
${{ runner.os }}-go-${{ inputs.go-version }}-
- name: set GOPATH
shell: bash