-
Notifications
You must be signed in to change notification settings - Fork 2
37 lines (31 loc) · 1.1 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
name: Deploy to Remote Server
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
# Step 1: SSH into the remote server and run deployment commands
- name: SSH into Remote Server and Deploy Changes
uses: appleboy/[email protected]
with:
host: ec2-3-87-142-202.compute-1.amazonaws.com
username: ubuntu
key: ${{ secrets.SSH_PRIVATE_KEY }}
passphrase: ${{ secrets.SSH_PASSPHRASE }}
port: 22
script: |
# Navigate to the project directory
cd ~/fossil-headers-db
# Pull the latest changes from the main branch
git fetch origin main
git reset --hard origin/main
# Ensure Docker and Docker Compose are installed
docker --version || { echo "Docker not found"; exit 1; }
docker-compose --version || { echo "Docker Compose not found"; exit 1; }
# Build and run the Docker Compose services
docker-compose down
docker-compose build --no-cache
docker-compose up -d