Skip to content

Commit 8e0b9ac

Browse files
authored
Add manual deploy workflow for server updates
1 parent 0248959 commit 8e0b9ac

1 file changed

Lines changed: 43 additions & 0 deletions

File tree

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Manual Deploy
2+
3+
# Trigger via actions tab
4+
on:
5+
workflow_dispatch:
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
deploy:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
# Step 1: Checkout the repository
16+
- name: Checkout repo
17+
uses: actions/checkout@v4
18+
19+
# Step 2: Connect to server via SSH and deploy
20+
- name: Deploy over SSH
21+
uses: appleboy/ssh-action@v1.2.0
22+
with:
23+
host: ${{ secrets.SSH_HOST }}
24+
username: ${{ secrets.SSH_USER }}
25+
key: ${{ secrets.SSH_KEY }}
26+
command_timeout: 10m
27+
script_stop: true
28+
script: |
29+
30+
# Crash out on error
31+
set -e
32+
33+
# CD to correct dir
34+
cd /root/server
35+
36+
# Ensure we are on the main branch
37+
git checkout main
38+
39+
# Pull changes from main
40+
git pull origin main
41+
42+
# Build and start container
43+
docker compose up --build --force-recreate --remove-orphans -d

0 commit comments

Comments
 (0)