-
Notifications
You must be signed in to change notification settings - Fork 2
39 lines (31 loc) · 1.12 KB
/
deploy-and-build.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
name: 🚀 Deploy bot on hosting
on:
push:
branches: [staging]
jobs:
update-src-folder:
name: 🪀 Update src folder with new files
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: src
- name: Setup SSH Key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SSH_PRIVATE_KEY }}
known_hosts: unnecessary
- name: Adding Known Hosts
run: ssh-keyscan -p ${{ secrets.SSH_PORT }} -H ${{ secrets.SSH_HOST }} >> ~/.ssh/known_hosts
- name: Deploy with rsync
run: rsync -rvzP --delete -e "ssh -p ${{ secrets.SSH_PORT }}" src ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}:home/xmnlz/vpitashka/
- name: Run docker compose
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USER }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
port: ${{ secrets.SSH_PORT }}
script: |
cd home/xmnlz/vpitashka/
docker compose --env-file .env.production up -d --no-deps --build vpitashka