forked from slant14/Database-Playground
-
Notifications
You must be signed in to change notification settings - Fork 0
37 lines (31 loc) · 974 Bytes
/
Copy pathdeploy.yml
File metadata and controls
37 lines (31 loc) · 974 Bytes
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 to the server via SSH
on:
push:
branches: [main]
jobs:
deploy:
if: github.repository == 'slant14/Database-Playground'
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Setup SSH key
run: |
mkdir -p ~/.ssh
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/deploy_key
chmod 600 ~/.ssh/deploy_key
shell: bash
- name: Add server to known_hosts
run: |
ssh-keyscan -p ${{ secrets.DEPLOY_PORT }} ${{ secrets.DEPLOY_IP }} >> ~/.ssh/known_hosts
shell: bash
- name: Deploy to server via SSH
run: |
ssh -i ~/.ssh/deploy_key -p ${{ secrets.DEPLOY_PORT }} ${{ secrets.DEPLOY_USER }}@${{ secrets.DEPLOY_IP }} << 'EOF'
set -e
cd ~/Database-Playground
git pull
docker compose build
docker compose up -d
EOF
shell: bash