-
Notifications
You must be signed in to change notification settings - Fork 0
99 lines (95 loc) · 3.55 KB
/
deploy.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
on:
push:
branches: [ "main" ]
jobs:
deploy:
runs-on: ubuntu-latest
env:
ProjectID: automatic_continuous_deployment
steps:
- name: Deploy to Virtual Private Server(VPS)
run: |
deployment_response = $(curl http://deployment1.yhs.kr:5000/deploy?project_id=${{ env.ProjectID }} \
-H 'Project-Token: {{ secrets.PROJECT_TOKEN }}' \
-H 'Token: {{ secrets.TOKEN }}')
if [ $deployment_response -eq "11" ]; then
echo "This project has disabled Automatic Continuous Deployment."
exit 11
elif [ $deployment_response -eq "12" ]; then
echo "No fetch result."
exit 12
elif [ $deployment_response -eq "13" ]; then
echo "Already Update"
exit 13
elif [ $deployment_response -eq "14" ]; then
echo "An error occurred during pull request."
exit 14
elif [ $deployment_response -eq "15" ]; then
echo "Unknown flags."
exit 15
elif [ $deployment_response -eq "43" ]; then
echo "Forbidden Access."
exit 43
elif [ $deployment_response -eq "44" ]; then
echo "Not Found."
exit 44
elif [ $deployment_response -eq "0" ]; then
echo "Success Deployment"
else
echo "Wrong Response."
exit 1
fi
- name: Apply a New Version
run: |
restart_response = $(curl http://deployment1.yhs.kr:5000/restart?project_id=${{ env.ProjectID }} \
-H 'Project-Token: {{ secrets.PROJECT_TOKEN }}' \
-H 'Token: {{ secrets.TOKEN }}')
if [ $deployment_response -eq "11" ]; then
echo "Unknown Project Type."
exit 21
elif [ $deployment_response -eq "43" ]; then
echo "Forbidden Access."
exit 43
elif [ $deployment_response -eq "44" ]; then
echo "Not Found."
exit 44
elif [ $deployment_response -eq "0" ]; then
echo "Success Apply a New Version."
else
echo "Wrong Response."
exit 2
fi
- name: Waiting for restart project (5 seconds minimum)
run: sleep 5s
shell: bash
- name: Checking Status
run: |
state_response = $(curl http://deployment1.yhs.kr:5000/state?project_id=${{ env.ProjectID }}
if [ state_response -eq "0" ]; then
echo "Success Deployment (Congratulations!)"
exit 0
elif [ state_response -eq "15" ]; then
echo "Success Deployment (but still turning on)"
exit 0
elif [ state_response -eq "12" ]; then
echo "Success Deployment However, You need verify that it works."
exit 0
elif [ $deployment_response -eq "13" ]; then
echo "Failure Deployment Please check the logs."
exit 33
elif [ $deployment_response -eq "14" ]; then
echo "Failure Deployment Please check the logs."
exit 34
elif [ $deployment_response -eq "16" ]; then
echo "Failure Deployment Please check the logs."
exit 36
elif [ $deployment_response -eq "17" ]; then
echo "Unknown Project Status Flags."
exit 37
elif [ $deployment_response -eq "11" ]; then
echo "Unknown Project Type."
exit 31
else
echo "Wrong Response."
exit 3
fi