-
Notifications
You must be signed in to change notification settings - Fork 2
37 lines (31 loc) · 1.01 KB
/
deploy.yaml
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
name: Deploy WhatsApp bot
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout Code 🔍
uses: actions/checkout@v3
- name: Install SSH Key 🔐
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SSH_PRIVATE_KEY }}
known_hosts: 'just-a-placeholder-so-we-dont-get-errors'
- name: Add known_hosts 🖥️
run: ssh-keyscan -H ${{ secrets.SERVER_IP }} >> ~/.ssh/known_hosts
- name: Upload with rsync 🔁
run: rsync -avz --exclude=".git" --exclude=".github" ./ root@${{ secrets.SERVER_IP }}:/root/wabot
# Execute command ke VPS
- name: Execute Command ☣️
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SERVER_IP }}
username: ${{ secrets.SERVER_USER }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
port: ${{ secrets.SERVER_PORT }}
script: |
cd /root/wabot
go build main.go