forked from austenstone/actions-playground
-
Notifications
You must be signed in to change notification settings - Fork 0
48 lines (43 loc) · 1.18 KB
/
dynamic-environments.yml
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
44
45
46
47
48
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 }}!"