-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (40 loc) · 1.35 KB
/
deploy.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
42
43
44
45
46
47
name: Deploy to Linode via SSH
on:
push:
branches:
- main # Change to your main branch name
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
submodules: 'recursive' # Clone submodules
- name: Update apt cache on the runner and install dependencies
run: sudo apt update && sudo apt install sshpass
- name: Set up SSH
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: copy file via ssh password
uses: appleboy/scp-action@master
with:
host: ${{ secrets.LINODE_IP }}
username: ${{ secrets.USER }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
port: 22
source: ./*
target: ${{ secrets.PATH_TO_SAVE }}
- name: execute container
uses: appleboy/[email protected]
with:
host: ${{ secrets.LINODE_IP }}
username: ${{ secrets.USER }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
port: 22
script: |
cd ${{ secrets.PATH_TO_SAVE }}
echo "source .env\nexport FRONTEND_MAPS_API_KEY=${{ secrets.FRONTEND_MAPS_API_KEY }}\ndocker-compose pull\ndocker-compose up -d --build" > run.sh
chmod +x run.sh
/bin/bash run.sh