Skip to content

Commit

Permalink
[Test] Deploy Test
Browse files Browse the repository at this point in the history
  • Loading branch information
gunyu1019 committed Jul 22, 2024
1 parent 066df85 commit af32648
Showing 1 changed file with 96 additions and 0 deletions.
96 changes: 96 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
on:
push:
branches: [ "main" ]

jobs:
deploy:
runs-on: ubuntu-latest
env:
ProjectID: Project ID
steps:
- name: Deploy to Virtual Private Server(VPS)
run: |
deployment_response = $(curl http://deployment1.yhs.kr/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/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/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

0 comments on commit af32648

Please sign in to comment.