Skip to content

Commit 6412a1d

Browse files
committed
feat: initial GH workflow
1 parent e7532dc commit 6412a1d

File tree

2 files changed

+79
-0
lines changed

2 files changed

+79
-0
lines changed

.github/workflows/deployment.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: deployment
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
branch:
7+
description: 'Branch to deploy'
8+
required: true
9+
default: 'main'
10+
11+
jobs:
12+
ssh-test:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
18+
- name: Deploy LangBuilder & OpenWebUI via SSH
19+
uses: appleboy/ssh-action@v1.0.3
20+
with:
21+
host: 54.221.139.4
22+
username: ubuntu
23+
key: ${{ secrets.DEV_SSH_KEY }}
24+
script: |
25+
set -e
26+
export BRANCH="${{ github.event.inputs.branch || 'devops-1' }}"
27+
export REPO_DIR="/home/ubuntu/cg_langbuilder/LangBuilder"
28+
export OPENWEBUI_DIR="$REPO_DIR/openwebui"
29+
export OPENWEBUI_BACKEND_DIR="$OPENWEBUI_DIR/backend"
30+
export LANGBUILDER_DIR="$REPO_DIR/langbuilder"
31+
32+
cd "$REPO_DIR"
33+
git fetch origin
34+
git checkout "$BRANCH"
35+
git pull origin "$BRANCH"
36+
37+
# Limpiar procesos previos
38+
pkill -f "open-webui" || true
39+
pkill -f "make run_cli" || true
40+
41+
cd "$OPENWEBUI_DIR"
42+
npm install --legacy-peer-deps
43+
npm run build
44+
45+
cd "$OPENWEBUI_BACKEND_DIR"
46+
source ~/miniconda3/etc/profile.d/conda.sh
47+
conda activate open-webui
48+
nohup bash dev.sh > /tmp/openwebui_backend.log 2>&1 &
49+
conda deactivate
50+
51+
cd "$LANGBUILDER_DIR"
52+
nohup make run_cli > /tmp/langbuilder.log 2>&1 &
53+
54+
echo "Deploy completo en branch $BRANCH"
55+
tail -n 20 /tmp/openwebui_backend.log || true
56+
tail -n 20 /tmp/langbuilder.log || true

.github/workflows/ssh-test.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: SSH Test to EC2
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- devops-1
8+
jobs:
9+
ssh-test:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v4
14+
15+
- name: SSH and create file with appleboy/ssh-action
16+
uses: appleboy/ssh-action@v1.0.3
17+
with:
18+
host: 54.221.139.4
19+
username: ubuntu
20+
key: ${{ secrets.DEV_SSH_KEY }}
21+
script: |
22+
echo 'Hello from GitHub Actions via appleboy!' > /tmp/github_actions_test.txt
23+
cat /tmp/github_actions_test.txt

0 commit comments

Comments
 (0)