-
Notifications
You must be signed in to change notification settings - Fork 0
43 lines (39 loc) · 1.19 KB
/
main.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
38
39
40
41
42
43
name: Build and Deploy
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Docker Compose
uses: hoverkraft-tech/[email protected]
with:
compose-file: "./docker-compose.yaml"
env:
DATABASE_URI: ${{ secrets.DATABASE_URI }}
RPC_URL_SEPOLIA: ${{ secrets.RPC_URL_SEPOLIA }}
deploy:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up SSH key
run: |
mkdir ~/.ssh
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
ssh-keyscan -p 22 ${{ secrets.SSH_HOST }} >> ~/.ssh/known_hosts
- name: Deploy
run: |
ssh ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} /bin/bash <<'ENDSSH'
cd ${{ secrets.APP_PATH }}
git pull origin main
export DATABASE_URI=${{ secrets.DATABASE_URI }}
export RPC_URL_SEPOLIA=${{ secrets.RPC_URL_SEPOLIA }}
docker compose -f docker-compose.yaml up -d --build
ENDSSH