-
Notifications
You must be signed in to change notification settings - Fork 8
53 lines (46 loc) · 1.55 KB
/
Copy pathdeployment.yml
File metadata and controls
53 lines (46 loc) · 1.55 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
44
45
46
47
48
49
50
51
52
53
name: deployment
on:
workflow_dispatch:
inputs:
branch:
description: 'Branch to deploy'
required: true
default: 'main'
workflow_run:
workflows:
- "Build and Push LangBuilder"
types: [completed]
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
# Only auto-deploy if the triggering build succeeded (or if manually triggered)
if: >
github.event_name == 'workflow_dispatch' ||
github.event.workflow_run.conclusion == 'success'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Deploy LangBuilder & OpenWebUI via SSH
timeout-minutes: 10
uses: appleboy/ssh-action@v1.0.3
with:
host: 54.221.139.4
command_timeout: 10m
username: ubuntu
key: ${{ secrets.DEV_SSH_KEY }}
script: |
set -ex
export BRANCH="${{ github.event.inputs.branch || 'main' }}"
export REPO_DIR="/home/ubuntu/cg_langbuilder/LangBuilder"
cd "$REPO_DIR"
git stash
git fetch origin
git checkout "$BRANCH"
git reset --hard "origin/$BRANCH"
cd deploy
docker network create langbuilder-network 2>/dev/null || true
docker compose pull
docker compose -f docker-compose.langbuilder.yml -f docker-compose.openwebui.yml --env-file .env up -d
echo "Deploy complete on branch $BRANCH"
docker compose -f docker-compose.langbuilder.yml -f docker-compose.openwebui.yml ps