-
-
Notifications
You must be signed in to change notification settings - Fork 15
43 lines (33 loc) · 1.01 KB
/
update-and-restart.yml
File metadata and controls
43 lines (33 loc) · 1.01 KB
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: Update and restart PRODUCTION server
# Trigger via actions tab
on:
workflow_dispatch:
permissions:
contents: read
jobs:
deploy:
runs-on: ubuntu-latest
steps:
# Step 1: Checkout the repository
- name: Checkout repo
uses: actions/checkout@v4
# Step 2: Connect to server via SSH and deploy
- name: Deploy over SSH
uses: appleboy/ssh-action@v1.2.0
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USER }}
key: ${{ secrets.SSH_KEY }}
command_timeout: 10m
script_stop: true
script: |
# Crash out on error
set -e
# CD to correct dir
cd /root/server
# Ensure we are on the main branch
git checkout main
# Pull changes from main
git pull origin main
# Build and start container
docker compose up --build --force-recreate --remove-orphans -d