-
Notifications
You must be signed in to change notification settings - Fork 1
38 lines (33 loc) · 1.24 KB
/
nginx.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
name : -Service- nginx
on:
workflow_dispatch
jobs:
deploy-nginx:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up SSH
run: |
mkdir -p ~/.ssh
echo "${{ secrets.LINUX_PRIVATE_KEY_BASE64 }}" | base64 -d > ~/.ssh/id_rsa
chmod 700 ~/.ssh
chmod 600 ~/.ssh/id_rsa
ssh-keyscan -t rsa ${{ secrets.LINUX_HOST }} >> ~/.ssh/known_hosts
- name : Delete Existing nginx directory
run: |
ssh -i ~/.ssh/id_rsa ${{ secrets.LINUX_USERNAME }}@${{ secrets.LINUX_HOST }} "rm -rf ~/dhammanava-search/nginx"
- name: Copy nginx directory to server
run: |
scp -r -i ~/.ssh/id_rsa nginx ${{ secrets.LINUX_USERNAME }}@${{ secrets.LINUX_HOST }}:~/dhammanava-search
- name: Deploy to Ubuntu server
uses: appleboy/ssh-action@master
with:
host: ${{secrets.LINUX_HOST}}
username: ${{secrets.LINUX_USERNAME}}
key: ${{ secrets.LINUX_PRIVATE_KEY }}
script: |
cd dhammanava-search
docker stop nginx-container || true
docker rm nginx-container || true
docker compose -f docker-compose.prod.yml up -d nginx