@@ -4,34 +4,39 @@ name: CD
4
4
5
5
# Controls when the action will run.
6
6
on :
7
- # Triggers the workflow on push or pull request events but only for the main branch
8
- push :
9
- branches : [ main ]
10
- pull_request :
11
- branches : [ main ]
12
-
13
7
# Allows you to run this workflow manually from the Actions tab
14
8
workflow_dispatch :
15
9
16
10
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
17
11
jobs :
18
- # This workflow contains a single job called "build"
12
+ build :
13
+ runs-on : ubuntu-latest
14
+ steps :
15
+
16
+ - uses : actions/checkout@v2
17
+
18
+ - name : Run a one-line script
19
+ run : echo Hello, world!
20
+
21
+ - name : Run a multi-line script
22
+ run : |
23
+ echo Add other actions to build,
24
+ echo test, and deploy your project.
25
+
19
26
deploy-staging :
27
+ needs : [build]
20
28
if : github.ref == 'refs/heads/main'
21
- # The type of runner that the job will run on
22
29
runs-on : ubuntu-latest
23
30
environment : staging
24
31
25
- # Steps represent a sequence of tasks that will be executed as part of the job
26
32
steps :
27
- # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
33
+
28
34
- uses : actions/checkout@v2
29
35
30
- # Runs a single command using the runners shell
36
+
31
37
- name : Run a one-line script
32
38
run : echo Hello, world!
33
39
34
- # Runs a set of commands using the runners shell
35
40
- name : Run a multi-line script
36
41
run : |
37
42
echo Add other actions to build,
@@ -40,22 +45,38 @@ jobs:
40
45
deploy-production :
41
46
needs : [deploy-staging]
42
47
if : github.ref == 'refs/heads/main'
43
- # The type of runner that the job will run on
48
+
44
49
runs-on : ubuntu-latest
45
50
environment : production
46
51
47
- # Steps represent a sequence of tasks that will be executed as part of the job
52
+
48
53
steps :
49
- # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
54
+
50
55
- uses : actions/checkout@v2
51
56
52
- # Runs a single command using the runners shell
53
57
- name : Run a one-line script
54
58
run : echo Hello, world!
55
59
56
- # Runs a set of commands using the runners shell
57
60
- name : Run a multi-line script
58
61
run : |
59
62
echo Add other actions to build,
60
63
echo test, and deploy your project.
61
64
65
+ deploy-review :
66
+ needs : [build]
67
+ if : github.event_name == 'pull_request'
68
+
69
+ runs-on : ubuntu-latest
70
+ environment : review
71
+
72
+ steps :
73
+
74
+ - uses : actions/checkout@v2
75
+
76
+ - name : Run a one-line script
77
+ run : echo Hello, world!
78
+
79
+ - name : Run a multi-line script
80
+ run : |
81
+ echo Add other actions to build,
82
+ echo test, and deploy your project.
0 commit comments