-
Notifications
You must be signed in to change notification settings - Fork 0
41 lines (38 loc) · 1.36 KB
/
CD.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
name: CD
on:
workflow_run:
workflows:
- CI
types:
- completed
jobs:
cd:
runs-on: sg
if: github.event.workflow_run.conclusion == 'success'
steps:
- name: Download Artifct
uses: dawidd6/action-download-artifact@v2
with:
workflow: CI
workflow_conclusion: success
run_id: ${{ github.event.workflow_run.id }}
run_number: ${{ github.event.workflow_run.run_number }}
name: unipay_${{ github.event.workflow_run.head_commit.id }}
- name: Deploy
run: |
host_name=""
branch="${{ github.event.workflow_run.head_branch }}"
if [[ "$branch" == "dev" ]]; then
host_name="backendtest"
elif [[ "$branch" == "test3" ]]; then
host_name="backendtest3"
else
echo "Skipping build and deploy for branch ${branch}"
exit 1
fi
rsync -a unipay_svr root@"$host_name":/mnt/das/server/unipay/unipay_svr
ssh root@"$host_name" 'chmod +x /mnt/das/server/unipay/unipay_svr'
ssh root@"$host_name" 'supervisorctl restart unipay_svr'
rsync -a refund_svr root@"$host_name":/mnt/das/server/unipay/refund_svr
ssh root@"$host_name" 'chmod +x /mnt/das/server/unipay/refund_svr'
ssh root@"$host_name" 'supervisorctl restart refund_svr'