-
Notifications
You must be signed in to change notification settings - Fork 2
45 lines (36 loc) · 1.26 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
name: Deploy to Remote Server
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v3
- name: Set up SSH 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: |
# Ensure Rust installed via rustup is used
export PATH="$HOME/.cargo/bin:$PATH"
# Verify Cargo is available
cargo --version || { echo "Cargo not found"; exit 1; }
# Navigate to the project directory
cd fossil-headers-db
git fetch origin main
git reset --hard origin/main
# Build the project
cargo build --release
# Move the binary to the correct location
sudo mv target/release/fossil_headers_db /usr/local/bin/fossil_headers_db
# Restart the service
sudo systemctl daemon-reload
sudo systemctl restart fossil_headers_db
sudo systemctl status fossil_headers_db --no-pager