-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy-docs.yml
More file actions
39 lines (32 loc) · 991 Bytes
/
deploy-docs.yml
File metadata and controls
39 lines (32 loc) · 991 Bytes
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
name: Deploy Docs
on:
push:
branches: ["main"]
paths:
- "docs/**"
- ".github/workflows/deploy-docs.yml"
jobs:
deploy:
name: Deploy via SSH
runs-on: ubuntu-latest
steps:
- name: Deploy to VPS
uses: appleboy/ssh-action@v1.2.4
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
port: ${{ secrets.PORT || 22 }}
script: |
bash -c '
REPO_URL="git@github.com:${{ github.repository }}.git"
DEPLOY_PATH="{{DEPLOY_PATH}}"
if [ ! -d "$DEPLOY_PATH" ]; then
git clone --depth 1 "$REPO_URL" "$DEPLOY_PATH"
fi
cd "$DEPLOY_PATH"
git fetch origin main
git reset --hard origin/main
docker compose -f {{DOCS_DIR}}/compose.yml down || true
docker compose -f {{DOCS_DIR}}/compose.yml up -d --build
'