-
Notifications
You must be signed in to change notification settings - Fork 102
83 lines (71 loc) · 1.96 KB
/
08-outputs-workflow.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
name: 08 - Outputs Workflow
on:
schedule:
- cron: "0 6 * * MON-FRI" # Runs at 6:00 UTC
workflow_dispatch:
jobs:
job1:
runs-on: ubuntu-latest
# Map a step output to a job output
outputs:
output1: ${{ steps.step1.outputs.test }}
output2: ${{ steps.step2.outputs.test }}
steps:
- id: step1
run: echo "::set-output name=test::hello"
- id: step2
run: echo "::set-output name=test::world"
job2:
runs-on: ubuntu-latest
# Wait from the job1 to be completed before starting job2
needs: job1
steps:
- run: echo ${{needs.job1.outputs.output1}} ${{needs.job1.outputs.output2}}
job3:
runs-on: ubuntu-latest
needs: [job1, job2]
steps:
- run: echo "Goodbye"
job4:
runs-on: ubuntu-latest
steps:
- name: step-1
id: xyz
run: echo "::set-output name=ip-address::$(curl -s ifconfig.me)"
- name: step-2
run: echo "${{ steps.xyz.outputs.ip-address }}"
- name: step-3
run: |
echo '{
"ip-address": "${{ steps.xyz.outputs.ip-address }}"
}'
job5:
runs-on: ubuntu-latest
steps:
- name: step-1
id: xyz
run: echo "::set-output name=acc::$(echo $RANDOM)"
- name: step-2
if: steps.xyz.outputs.acc < 1
run: |
echo "Number lower than 1"
echo "${{ steps.xyz.outputs.acc }}"
- name: step-3
if: steps.xyz.outputs.acc > 1
run: |
echo "Number higher than 1"
echo "${{ steps.xyz.outputs.acc }}"
# job6:
# runs-on: ubuntu-latest
# steps:
# - name: step-1
# id: wxyz
# uses: actions/create-release@v1
# with:
# tag_name: 0.0.1
# release_name: 0.0.1
# body: "This is release 0.0.1"
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# - name: step-2
# run: echo "${{ steps.wxyz.outputs.html_url }}"