diff --git a/.github/actions/set-go-version-in-env/action.yml b/.github/actions/set-go-version-in-env/action.yml index 7276e6d4f9af..1600c1c722ea 100644 --- a/.github/actions/set-go-version-in-env/action.yml +++ b/.github/actions/set-go-version-in-env/action.yml @@ -10,5 +10,9 @@ runs: using: composite steps: - name: Set the project Go version in the environment - run: .github/actions/set-go-version-in-env/go_version_env.sh >> $GITHUB_ENV + # sed works in all environments but `go list -m -f '{{.GoVersion}}'` should be preferred + # outside of CI when go is already installed. + run: | + cd ${{ github.workspace }} + echo GO_VERSION="~$(sed -n -e 's/^go //p' go.mod)" >> $GITHUB_ENV shell: bash diff --git a/.github/actions/set-go-version-in-env/go_version_env.sh b/.github/actions/set-go-version-in-env/go_version_env.sh deleted file mode 100755 index 60b643ac386e..000000000000 --- a/.github/actions/set-go-version-in-env/go_version_env.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env bash - -set -euo pipefail - -# Prints the go version defined in the repo's go.mod. This is useful -# for configuring the correct version of go to install in CI. -# -# `go list -m -f '{{.GoVersion}}'` should be preferred outside of CI -# when go is already installed. - -# 2 directories above this script -AVALANCHE_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )"; cd ../.. && pwd ) - -echo GO_VERSION="~$(sed -n -e 's/^go //p' "${AVALANCHE_PATH}"/go.mod)"