Update README #16
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| name: Test Loop 2 | |
| on: | |
| push: | |
| branches: [development] | |
| jobs: | |
| # Job 1: Collect data | |
| define-matrix: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| json-project: ${{ steps.project-step.outputs.json-project }} | |
| steps: | |
| - name: Define Project String | |
| id: project-step | |
| run: | | |
| echo "json-project={\"count\":2,\"include\":[{\"project\":\"1\",\"config\":\"Debug\"},{\"project\":\"2\",\"config\":\"Release\"}]}" >> "$GITHUB_OUTPUT" | |
| # Job 2: Print the output of the "define-matrix" job | |
| print-output: | |
| runs-on: ubuntu-latest | |
| needs: define-matrix | |
| steps: | |
| - name: Print project-json variable | |
| id: print-stuff | |
| run: | | |
| echo ${{ toJson(needs.define-matrix.outputs.json-project) }} | |
| echo ${{ toJson(needs.define-matrix.outputs.json-project) }} | jq -r '.include[].project' | |
| # echo ${{ toJson(needs.define-matrix.outputs.json-project) }} | jq -r '.include[].project' | |
| # Job 3: Loop through array | |
| print-array-output: | |
| runs-on: ubuntu-latest | |
| needs: define-matrix | |
| strategy: | |
| matrix: | |
| include: ${{ fromJson(needs.define-matrix.outputs.json-project).include }} | |
| steps: | |
| - name: Print project-json variable | |
| id: print-array-item | |
| run: | | |
| echo "The project ID is: ${{ matrix.project }}" | |
| # echo ${{ matrix }} | jq -r '.project' |