From cd4534543719a14721de2c683c864c27de9f622e Mon Sep 17 00:00:00 2001 From: Sachin Sahu <75629410+SachinSahu431@users.noreply.github.com> Date: Tue, 2 Apr 2024 05:10:59 +0000 Subject: [PATCH] ci: Remove hardcoded supported Go versions from go.yml Signed-off-by: Sachin Sahu <75629410+SachinSahu431@users.noreply.github.com> --- .github/workflows/go.yml | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index c72b96c..1756c89 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -12,13 +12,29 @@ permissions: contents: read jobs: + supportedVersions: + name: Fetch supported Go versions + runs-on: ubuntu-latest + outputs: + supported_versions: ${{ steps.matrix.outputs.supported_versions }} + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Read supported_go_versions.txt + id: matrix + run: | + versions=$(head -n 3 supported_go_versions.txt) + matrix="[$(echo "$versions" | sed 's/\(.*\)/"\1"/' | paste -s -d,)]" + echo "supported_versions=$matrix" >> $GITHUB_OUTPUT + test: name: Tests runs-on: ubuntu-latest + needs: supportedVersions strategy: matrix: - go_version: ["1.20", "1.21", "1.22"] + go_version: ${{ fromJSON(needs.supportedVersions.outputs.supported_versions) }} steps: - name: Checkout code