ci: Remove hardcoded supported Go versions from go.yml

Signed-off-by: Sachin Sahu <75629410+SachinSahu431@users.noreply.github.com>
This commit is contained in:
Sachin Sahu 2024-04-02 05:10:59 +00:00
parent e38b67e77a
commit cd45345437
1 changed files with 17 additions and 1 deletions

View File

@ -12,13 +12,29 @@ permissions:
contents: read contents: read
jobs: 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: test:
name: Tests name: Tests
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: supportedVersions
strategy: strategy:
matrix: matrix:
go_version: ["1.20", "1.21", "1.22"] go_version: ${{ fromJSON(needs.supportedVersions.outputs.supported_versions) }}
steps: steps:
- name: Checkout code - name: Checkout code