| 1 | name: Dynamic matrix |
| 2 | on: push |
| 3 | jobs: |
| 4 | plan: |
| 5 | runs-on: ubuntu-latest |
| 6 | outputs: |
| 7 | matrix: ${{ steps.set.outputs.matrix }} |
| 8 | steps: |
| 9 | - id: set |
| 10 | run: echo 'matrix={"include":[{"project":"foo","config":"Debug"},{"project":"bar","config":"Release"}]}' >> "$GITHUB_OUTPUT" |
| 11 | build: |
| 12 | needs: plan |
| 13 | runs-on: ubuntu-latest |
| 14 | strategy: |
| 15 | matrix: ${{ fromJSON(needs.plan.outputs.matrix) }} |
| 16 | steps: |
| 17 | - run: echo "${{ matrix.project }} ${{ matrix.config }}" |
| 18 | whole-strategy: |
| 19 | needs: plan |
| 20 | runs-on: ubuntu-latest |
| 21 | strategy: |
| 22 | fail-fast: ${{ github.event_name == 'push' }} |
| 23 | matrix: |
| 24 | include: ${{ fromJSON(needs.plan.outputs.matrix).include }} |
| 25 | steps: |
| 26 | - run: echo ok |