-
Notifications
You must be signed in to change notification settings - Fork 8
44 lines (37 loc) · 1.19 KB
/
build.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
name: Dynamic Matrix from config.yaml
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-20.04
# Use this action to check out the code so we can read the config.yaml
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Install yq
run: |
sudo wget https://github.com/mikefarah/yq/releases/download/v4.2.0/yq_linux_amd64 -O /usr/bin/yq
sudo chmod +x /usr/bin/yq
# Read the config.yaml file and set the versions as an output
- name: Get versions from config.yaml
id: get_versions
run: |
echo "versions=$(yq -j -I=0 eval '.versions' config.yaml)" >> $GITHUB_OUTPUT
# Print matrix for debugging purposes (Optional)
- name: Print matrix
run: echo "${{ steps.get_versions.outputs.versions }}"
outputs:
# Will look like '["6.0.0rc1", "5.3.2"]'
versions: ${{ toJSON(steps.get_versions.outputs.versions) }}
# Use the dynamic matrix
matrix-from-config:
needs: build
runs-on: ubuntu-20.04
strategy:
matrix: ${{ fromJson(needs.build.outputs.versions) }}
steps:
- name: Run job for matrix element
run: |
echo "Running for version: ${{ matrix }}"