Skip to content

Update artifacts-in-reusable-caller.yml #131

Update artifacts-in-reusable-caller.yml

Update artifacts-in-reusable-caller.yml #131

name: Dynamic Envs
on:
push:
pull_request:
workflow_dispatch:
jobs:
build-env:
runs-on: ubuntu-latest
steps:
- id: build-env
run: echo "envs=['env1', 'env2', 'env3']" >> "$GITHUB_OUTPUT"
outputs:
env-names: ${{ steps.build-env.outputs.envs }}
deploy-env:
runs-on: ubuntu-latest
needs: [build-env]
strategy:
matrix:
name: ${{ fromJson(needs.build-env.outputs.env-names) }}
fail-fast: false
environment:
name: ${{ matrix.name }}
steps:
- run: echo "Hello ${{ matrix.name }}!"
build-env-2:
runs-on: ubuntu-latest
steps:
- id: build-env-2
run: echo "envs=[{name:'env1',url:'https://env1.com'},{name:'env2',url:'https://env2.com'},{name:'env3',url:'https://env3.com'}]" >> "$GITHUB_OUTPUT"
outputs:
env-names: ${{ steps.build-env-2.outputs.envs }}
deploy-env-2:
runs-on: ubuntu-latest
needs: [build-env-2]
strategy:
matrix:
env: ${{ fromJson(needs.build-env-2.outputs.env-names) }}
fail-fast: false
environment:
name: ${{ matrix.env.name }}
url: ${{ matrix.env.url }}
steps:
- run: echo "Hello ${{ matrix.env.name }}!"