Skip to content

Commit

Permalink
feat: change ci cd
Browse files Browse the repository at this point in the history
  • Loading branch information
sjatsh committed Sep 20, 2023
1 parent 3e4cbcf commit 8ad3c5b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
24 changes: 17 additions & 7 deletions .github/workflows/CD.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,20 @@ jobs:
workflow_conclusion: success
run_id: ${{ github.event.workflow_run.id }}
run_number: ${{ github.event.workflow_run.run_number }}
name: sub_account
- name: Stop Service
run: ssh root@backendtest 'supervisorctl stop sub_svr'
- name: Rsync
run: rsync -a sub_account root@backendtest:/mnt/das/server/sub-account-svr/sub_account
- name: Restart Service
run: ssh root@backendtest 'chmod +x /mnt/das/server/sub-account-svr/sub_account && supervisorctl start sub_svr'
name: sub_account_${{ 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 sub_account root@"$host_name":/mnt/das/server/sub-account-svr/sub_account
ssh root@"$host_name" 'chmod +x /mnt/das/server/sub-account-svr/sub_account'
ssh root@"$host_name" 'supervisorctl restart sub_svr'
3 changes: 2 additions & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- dev
- test3

jobs:
ci:
Expand All @@ -20,5 +21,5 @@ jobs:
- name: Upload Artifacts
uses: actions/[email protected]
with:
name: sub_account
name: sub_account_${{ github.sha }}
path: ./sub_account

0 comments on commit 8ad3c5b

Please sign in to comment.