Skip to content

Commit cd45345

Browse files
committed
ci: Remove hardcoded supported Go versions from go.yml
Signed-off-by: Sachin Sahu <[email protected]>
1 parent e38b67e commit cd45345

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

.github/workflows/go.yml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,29 @@ permissions:
1212
contents: read
1313

1414
jobs:
15+
supportedVersions:
16+
name: Fetch supported Go versions
17+
runs-on: ubuntu-latest
18+
outputs:
19+
supported_versions: ${{ steps.matrix.outputs.supported_versions }}
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v4
23+
- name: Read supported_go_versions.txt
24+
id: matrix
25+
run: |
26+
versions=$(head -n 3 supported_go_versions.txt)
27+
matrix="[$(echo "$versions" | sed 's/\(.*\)/"\1"/' | paste -s -d,)]"
28+
echo "supported_versions=$matrix" >> $GITHUB_OUTPUT
29+
1530
test:
1631
name: Tests
1732
runs-on: ubuntu-latest
33+
needs: supportedVersions
1834

1935
strategy:
2036
matrix:
21-
go_version: ["1.20", "1.21", "1.22"]
37+
go_version: ${{ fromJSON(needs.supportedVersions.outputs.supported_versions) }}
2238

2339
steps:
2440
- name: Checkout code

0 commit comments

Comments
 (0)