Skip to content

Update test-loop.yml #4

Update test-loop.yml

Update test-loop.yml #4

Workflow file for this run

---
name: Test Loop
on:
push:
branches: [development]
jobs:
# Job 1: Collect data
define-matrix:
runs-on: ubuntu-latest
outputs:
colors: ${{ steps.colors.outputs.colores }}
steps:
- name: Define Colors
id: colors
run: |
echo 'colores=["red", "green", "blue"]' >> "$GITHUB_OUTPUT"
## Print the output of the "define-matrix" job
print-output:
runs-on: ubuntu-latest
needs: define-matrix
steps:
- name: Print variable
run: |
echo ${{ needs.define-matrix.outputs.colors }}
# Job 2: Display data using "run" and "with"
produce-artifacts:
runs-on: ubuntu-latest
needs: define-matrix
strategy:
matrix:
color: ${{ fromJSON(needs.define-matrix.outputs.colors) }}
steps:
- name: Define Color
env:
color: ${{ matrix.color }}
run: |
echo "$color" > color
# - name: Produce Artifact
# uses: actions/upload-artifact@v4
# with:
# name: ${{ matrix.color }}
# path: color
# - run: mkdir -p path/to/artifact
# - run: echo hello > path/to/artifact/world.txt
# - uses: actions/upload-artifact@v4
# with:
# name: my-artifact
# path: path/to/artifact/world.txt
# Job 3: Display data another way
# consume-artifacts:
# runs-on: ubuntu-latest
# needs:
# - define-matrix
# - produce-artifacts
# strategy:
# matrix:
# color: ${{ fromJSON(needs.define-matrix.outputs.colors) }}
# steps:
# - name: Retrieve Artifact
# uses: actions/download-artifact@v4
# with:
# name: ${{ matrix.color }}
# - name: Report Color
# run: |
# cat color